Problem Saving Excel in VB

cyclonebri
01-31-2002, 08:50 AM
Hi all,

I am making an application that reads data from our SQL Server to an excel spreadsheet, which I then want to save as a Web page after the data is in the spreadsheet.

I have 2 questions, and if anyone can help or point me in the right direction I would be much obliged...

1) I am trying to save the application as a websheet, so I use the following line:

xlsApp.ActiveWorkbook.SaveAs "X:\test\" & filename & ".htm", xlHtml

however this gives me an application exception memory error and crashes the VB application. Can anyone help me figure out what is wrong with that line of code?

2) There is a place on the webpage save menu that, when selected, checks a box entitled "Add Interactivity" How can I make this default to true?

Thanks in advance for any help you can offer me!
Brian

karimahta
01-31-2002, 11:53 AM
I find an easy way to work out the code for things in Excel or Word is to record a macro (on the Tools menu -> Macro) and perform the actions I want to emulate in code.

If you do that to save your worksheet as a webpage, and check interactivity, you will get the correct method to do this (doesn't seem to be the .SaveAs, rather it uses .Publish)

Anyway, I can't stress enough the use of the record macro to write VBA code for Word and Excel.


HTH

cyclonebri
01-31-2002, 05:38 PM
Hey, thanks for the advice, I used a macro to find the code, and eventually that was the code I needed. However, there was a major problem. Using Excel in XP and the newest version of MSVS6, I had the Excel 10.0 object library. Unfortunately, I needed the excel 9.0 library. Don't ask me why, but for some reason the 10.0 library was not working like I needed it to.

So, once again thank you for the advice, as it did eventually lead me to the solution!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum