control excel from web page

  • Thread starter Thread starter C Williams
  • Start date Start date
C

C Williams

Hi,

I would like to build a small feature on a web page. I would like for a
user to be able to enter the path of an Excel file into a field and then
click a button that will open the file and allow further manipulation of
it, both manually by the user and controlled by code. Unfortunately, I
have never programmed anything for the web and am not sure where to
start...I have plenty of experience interacting with excel from vb code,
however, and will be using vb.net. Where is a good place to start?

Thanks in advance for you help. Please direct me if you think there
would be a better newsgroup to post this.

-Casey
 
Hello Casey,

The following code will get you started:

<html>
<head>
<title>Open Excel Workbook</title>
<script language="vbscript">
Sub openExcel
Dim xlApp
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open document.all("wbkFilePath").value
End Sub
</script>
</head>
<body>
<form>
<input id="wbkFilePath" type="text"><input type="button"
value="Open Excel" onclick="openExcel">
</form>
</body>
</html>

You can then interact with Excel via its object model.

Note 1: Excel has to be present on the user's machine.
Note 2: For the script to work, the user's Internet Explorer security
settings will have to be relaxed a bit. "Initialize and script ActiveX
controls not marked as safe" has to be set to "Prompt" in the appropriate
zone.

Hope this helps,

-Daniel
 
Back
Top