Mariusz Adamczewski Mariusz Adamczewski - 29 days ago 20
HTML Question

HTML - Open localization via explorer.exe / file via excel

I have got hyperlink in HTML.

I used this code, for example:

<a href="//Test/Test/Test" target="_explorer.exe">Open_Me</a>


Question 1: I want to do is to open localization in explorer.exe. How I can make it?

Question 2: I need to do is to open file (excel with macro - xlsm) via hyperlink in excel.

<a href="//Test/Test/Test/Test.xlsm">Click_Me</a>


Maybe I should add something into meta? Please write What should I do.

Thank you

Answer

You can open same new browser by setting property target="_new", but you can't open it in different browser.
Anyvay, you can open popup window using javascript, but it is not the best. http://www.aspsnippets.com/Articles/popups.aspx


You need to create a shared folder on your network and put the workbook there. You can then use the file:///SERVER/PATH/FILE.xls format in your <a /> links on your intranet to direct your user to the actual file on the server.

I would recommend you start by creating a simple html doc on your desktop to get familiar with the file:/// path format. Eg

<html>
    <head />
    <body>
        <a href="file:///SERVER/PATH/FILE.xls">Click</a>
    <body>
 <html>

save that in notepad and rename the extension from .txt to .html.

You can also type file:/// paths straight into windows explorer's address bar which allow for testing paths without resorting to the html document mentioned above.

UNFORTUNATELY! It seems that the browsers default behavior is to always download a link rather than open it (even if it is a local resource), so if you actually want to open it then you must resort to changing your browser intranet permissions to allow JS to access local resources, which then allows you to use the technique below.


This article (http://www.codeproject.com/Articles/113678/How-to-execute-a-Local-File-using-HTML-Application) uses

<script type="text/javascript" language="javascript">
    function RunFile() {
    WshShell = new ActiveXObject("WScript.Shell");
    WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
    }
</script>

to open notepad. You can use command line arguments with Excel.exe (https://support.office.com/en-za/article/Command-line-switches-for-Excel-321cf55a-ace4-40b3-9082-53bd4bc10725) to tell it what the file path is...

Excel.exe "C:\PATH\Excel.xls"

From here more information by @3-14159265358979323846264.