SaveAs in Excel

C

Chris

Hello All, I'm opening an existing Excel spreadsheet adding data to it and
then saving it as a new document. I want to keep the original spreadsheet
hidden from the user. But when the user goes to open the new speadsheet, the
original is coming up as well. I'm doing this in VB6 on a Vista machine
using Office2007.
 
C

Chris

Here is the general jist of my code:
Dim xlapp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlapp = CreateObject("Excel.application")
Set xlBook = xlapp.Workbooks.Open("c:\bomout.xls") ' this is the template
Set xlSheet = xlapp.Sheets(1)
xlSheet.Cells(5, 1).CopyFromRecordset v_recordset 'assign some data
xlSheet.SaveAs "c:\Temp.xls" 'save as
new worksheet
xlBook.Close
'close workbook
xlapp.Quit
'quit excel
Set xlapp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
 
S

Steve Rindsberg

Can you explain the problem a little more?

You say "But when the user goes to open the new speadsheet, the original is coming
up as well."

The user doubleclicks C:\Temp.xls and C:\bomout.xls opens also?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top