Saving Workbooks in Excel

miktek
05-02-2001, 09:53 AM
I am using Excel 97 VBA to open a new workbook and save.
e.g.
Workbooks.Add.SaveAs (sPath & FilenameTimeStamp)
I then have some code that copies sheets from the original workbook to this newly created workbook.
I then do a
Windows("filename.xls").Close which closes the original workbook and leaves the new workbook open.

Everything is fine except that when I open the new workbook later I always get this "Workbook contains links to to info in another workbook. Update all linked info or not?" message box. I didn't realize I would have these links or this message. Is there a way to stop the message or the links from happening?
Thanks,
Mike

Alex_Laing
05-02-2001, 02:10 PM
Before you open the workbook try using the statement "Application.DisplayAlerts = False".

This will silence those alerts that you may not want to see. Be sure to set it back to TRUE when you are finished.

miktek
05-02-2001, 02:52 PM
Sounds good but I don't think it helps me in this case. I've used that command a lot when I'm within a file running code. The problem here is that I have used VBA to create a new workbook, copy some sheets to it and then all workbooks are closed. Excel is closed. Then, when I open the workbook I created from before with copied sheets, I get the message when Excel opens. Copying the sheets must create some kind of link that I'm not aware of. If any links are being created, I don't care because all I'm trying to do is create a report with a few sheets of data after the main program runs.
The question about updating links is confusing to people who open the file later.
hope this makes sense.

dtheffron
05-02-2001, 06:17 PM
If your cell formulas have references to other sheets within the master workbook, then copies of the master will point back to the master workbook. Try creating a workbook that has all the sheets you want (without external links). Your app will copy this workbook, edit the data fields, delete unnecessary sheets, and save it with a new name.

Any sufficiently advanced technology is indistinguishable from magic - Arthur C. Clarke

Matt Nash
05-04-2001, 04:16 AM
Use <font color=blue>Workbooks.Open "c:\my documents\book1.xls",3</font color=blue>.

The <font color=blue>,3</font color=blue> tells Excel to automatically update links to both internal and external sources.

Hope this helps,

Matt

"You don't need a weatherman to know which way the wind blows" - Bob Dylan

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum