I could use some help. I have a function that opens an Excel spreadsheet to load data from it. The function is found inside <head> </head> and within that inside <script></script> (see below). The problem is that I need to write that data inside the row of a table in the <body>. How do I reference variables declared and assigned inside a script in the head section from the body of my page?
On a separate topic, how do I get rid of the error message (below) that pops up when the function which opens the Excel spreadsheet executes as follows:
<head>
<script>
var global_var="";
function loadexcel() {
var serverLoc = "http://mydomain.com/excel_folder/";
var serverFile = serverLoc+"my_excel.xls";
var ehandle = new ActiveXObject("Excel.Application");
var eWBhandle = ehandle.Workbooks.Open(serverFile);
var eShandle = eWBhandle.ActiveSheet;
global_var = eShandle.Cells(1,1).Value;
eWBhandle.Close();
}
</script>
</head>
<body>
......
<table>
<td>
<tr>
<script>
document.write(global_var); // writes ""
</script>
</tr>
</td>
</table>
......
</body>
The error message I get every time I open the page when I run the page on my local machine (vs loaded on a server and run there) is:
An ActiveX control on this page might be unsafe to
interact with other parts of the page. Do you want to
allow this interaction? Yes/No
On the server, I get a Microsoft error in the yellow error message bar at the top of the page saying the web page wants to run an add-on with no name and ca ontrol with no name. So you appear to be able to respond once to that then it doesn't bother you again.
So when running on my client, is there any way to suppress the above error message? When running on the server, for first time visitors, how do I name the add-on and control so it's a little more palatable (vs something called "unknown")?
MS