|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Open Excel Fileopen an Excel file stored on the web: Dim xlApp Set xlApp = CreateObject("Excel.Application") xlApp.DisplayAlerts = False On Error Resume Next Set oWorkbook = xlApp.Workbooks.Open("http://xxxxx.com/ myworkbook.xls") If Err.Number <> 0 Then WScript.Quit End If xlApp.Visible = True oWorkbook.Activate I would like to put this vbscript on the web so other people can use it. Ideally, I want to give them an "http://...." address that they can navigate to, and when they do, the vbscript living in this http location would automatically activate and open the Excel file on their local PC's (in Excel itself and not embedded in IE). I have little experience with ASP and HTML (but know a fair bit of Excel VBA), and would appreciate the complete HTML / ASP code that would incorporate the above vbscript to achieve this purpose. Thanks for your help. AP Gazing into my crystal ball I observed tianung <tian***@hotmail.com>
writing in news:fbe5115f-bc45-40b0-9ad0-728492de0a78 @o18g2000pra.googlegroups.com: Show quoteHide quote > I have the following vbscript (living on my PC desktop) that I use to You need to set the application type in the header. Make sure you put > open an Excel file stored on the web: > > Dim xlApp > Set xlApp = CreateObject("Excel.Application") > xlApp.DisplayAlerts = False > On Error Resume Next > Set oWorkbook = xlApp.Workbooks.Open("http://xxxxx.com/ > myworkbook.xls") > If Err.Number <> 0 Then > WScript.Quit > End If > xlApp.Visible = True > oWorkbook.Activate > > I would like to put this vbscript on the web so other people can use > it. Ideally, I want to give them an "http://...." address that they > can navigate to, and when they do, the vbscript living in this http > location would automatically activate and open the Excel file on their > local PC's (in Excel itself and not embedded in IE). I have little > experience with ASP and HTML (but know a fair bit of Excel VBA), and > would appreciate the complete HTML / ASP code that would incorporate > the above vbscript to achieve this purpose. > > Thanks for your help. > > AP > this BEFORE anything else. response.contenttype = "application/vnd.ms-excel" 'rest of your script Now, as to how the file opens is up to the user. If the user has explicitly set excel files to open in the browser, then they will. There is nothing you can do about that. What I would suggest, however, is warn the user first that it's an excel file, something like: <a href="myexcelfile.asp" type="application/vnd.ms-excel" title="Excel spreadsheet">Download Excel spreadsheet</a> -- Adrienne Boswell at Home Arbpen Web Site Design Services http://www.cavalcade-of-coding.info Please respond to the group so others can share On Jul 5, 6:52 am, Adrienne Boswell <arb***@yahoo.com> wrote:
> Thanks Adrienne. When I said I have limited experience, I mean I've> You need to set the application type in the header. Make sure you put > this BEFORE anything else. > > response.contenttype = "application/vnd.ms-excel" > 'rest of your script > never written a single html/asp script before ! :-) Do I simply write this and save as <some filename>.html at the "http:// ..." location ? (Please bear with my total ignorance) ------ <html> <body> <% response.contenttype = "application/vnd.ms-excel" Dim xlApp Set xlApp = CreateObject("Excel.Application") xlApp.DisplayAlerts = False On Error Resume Next Set oWorkbook = xlApp.Workbooks.Open("http://xxxxx.com/ myworkbook.xls") If Err.Number <> 0 Then WScript.Quit End If xlApp.Visible = True oWorkbook.Activate %> </body> </html>
Other interesting topics
ASP Classic - Alphabetical lists
Paging with ASP Classic Large row count from stored procedure Urgent: getting recordcount after running Stored Procedure LEFT JOIN problem Classic ASP, <SELECT> postback, Browser Navigation Script from variables Microsoft OLE DB Provider for ODBC Drivers error '80004005' Problem with Instr to find a space Cannot use parentheses when calling a Sub |
|||||||||||||||||||||||