Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SaveAs Method of Workbook Class failed - XL 2k VB 5.0

Status
Not open for further replies.

KyleS

Programmer
Oct 23, 2001
619
US
Hi,

I'm using the free eval copy of Excel 5.0 (don't ask, let's just say my work is a little cheap...)

I've got my application all ready to go, it opens and edit Excel workbooks, and then when saved, moves the file somewhere where the user can't get to it and saves the pertinent data to my Access 97 dB.

All that code is fine, but when I try:

objExcel.SaveAs "C:\TEST.xls" 'objExcel being a workbook...

I get that error... "SaveAs Method of Workbook Class failed" I get the same error for Add, SaveCopyAs, etc, basically any method attached to the workbook. I also ge tthat error for most Worksheet functions as well, and application functions too.

Here's the code I'm using to set up my object:

OLE1.CreateEmbed ("C:\TEST1.xls")

Set objExcel = OLE1.object

OLE1 houses the embedded Excel Workbook, and when I add a watch to objExcel, it shows it as a workbook, and I can edit all the fields and format all the pictures and shapes with no problems, so I know it's working...

I guess my question is, since I'm using an embedded OLE, is saving the Excel file just not possible?


Kyle
 

Perhaps you are missing some parameters. Use the Excel VBA editor and help file to figure it out.

Good Luck

 
Thanks for the reply...

I've got all the parameters, tried using the Excel VBA editor... Nothing seems to work. Can it be an issue with the Excel file itself?

If I create another variable, and set it = to a new instance of Excel, all this syntax works fine, but if I copy the current worksheets into my ew instance of excel, the save function stops working again.

Very confusing...


Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top