If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > SaveAs method of Workbook class failed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-04, 15:00
markozob markozob is offline
Registered User
 
Join Date: Apr 2004
Posts: 1
Angry SaveAs method of Workbook class failed

Stupid job, actually. Every day I have to connect to certain server, get an XLS file, open it, save as HTML and upload to web server. Source filename is always the same. To cut it short, the VBS I am working on simply doesn't do it - it returns the "SaveAs method of Workbook class failed" error. And I am really lost here!
I know it's not ASP code, but it's very similar.

Here's the script:

-----START------
set filesys=CreateObject("Scripting.FileSystemObject")
pathstring = filesys.GetAbsolutePathName(".")
pathstring=pathstring & "\"
file = InputBox("Filename,without the extension","Enter")

Set xl = CreateObject("Excel.Application")
xl.visible = false
xl.WorkBooks.Open pathstring & file & ".xls"
xl.ActiveWorkbook.SaveAs pathstring & file & ".htm", xlHTM
xl.ActiveWorkbook.Close
xl.quit
-----END------

The one MsgBox asks (for the testing purposes) for the filename. The script and the XLS file both exist on my Desktop (same folder), and so should the HTM file, too.

Thanx!
Reply With Quote
  #2 (permalink)  
Old 04-15-04, 19:46
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Okie, I haven't tried this before but a couple of thoughts that might help.....

Does the htm file already exist?? Are you attempting to write over an existing file.

I have been looking at some examples online and the method call seems slightly different... particularly the specification of the file format... they tend to use something like Excel.XlFileFormat.xlHtml

check out this link.... http://msdn.microsoft.com/library/de...eworkbooks.asp

Hope that helps....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On