Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72388

JavaScript Function not working but filters for are removed

$
0
0

I am trying to use the function below to open an excel document on a specific sheet. When I used it on a standalone HTML document the function worked.

The site is running on IE 11 as I understand you must to use an ActiveXobject. The text doesn't even underline in Plone like it does on my standalone test page I created.

Why exactly does the function not work in Plone?

<script type="text/javascript">
    function Open_Excel_File(path,sheet)
      {

        fso = new ActiveXObject("Scripting.FileSystemObject");

        if (!fso.FileExists(path))
          alert("Cannot open file.\nFile '" + path + "' doesn't exist.");

        else
         {
           var myApp = new ActiveXObject("Excel.Application");

           if (myApp != null)
             {
               myApp.visible = true;
               Book = myApp.workbooks.open(path);
               var excel_sheet = Book.Worksheets(sheet).Activate;
               myApp.range(f_range).Select;
             }

           else {
             alert ("Cannot open Excel application");
           }
         }
      }
 </script>

<input type="button" value="Load" onclick="Open_Excel_File('C:\\Users\\user\\Desktop\\test1.xlsm', 'sheet2');"> </input>

<a href="#" onclick="Open_Excel_File('C:\\Users\\user\\Desktop\\test1.xlsm', 'sheet2');"> Open with Href</a>

Viewing all articles
Browse latest Browse all 72388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>