VB6: Closing a single workbook while leaving the rest open 
Author Message
 VB6: Closing a single workbook while leaving the rest open

The following code:

Set SourceData = Workbooks.Open(FileName:="source.xls", UpdateLinks:=0)
Set Quarterly = Workbooks.Open(FileName:="Triangles.xls", UpdateLinks:=0)
' operations
SourceData.close

Closes both workbooks and excel itself.  Doing

workbooks("source.xls").close

has the same effect.  How can I close the source.xls while leaving the other
workbook open?

Thanks

--
Erik Bause/Bause Associates

Check out THE THREE 4 TENS at http://www.*-*-*.com/



Wed, 18 Jun 1902 08:00:00 GMT  
 VB6: Closing a single workbook while leaving the rest open

Quote:

> Set SourceData = Workbooks.Open(FileName:="source.xls", UpdateLinks:=0)
> Set Quarterly = Workbooks.Open(FileName:="Triangles.xls", UpdateLinks:=0)
> ' operations
> SourceData.close

> Closes both workbooks and excel itself.

I suggest there is a macro in SourceData that runs when it is closed
(Workbook_BeforeClose) that is having this effect.  It should not happen
otherwise.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup



Sat, 05 Apr 2003 08:20:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Macro to open a workbook, work in that workbook, than close the workbook (saved)

2. Disabling a closed workbook from an open workbook

3. Copying Sheets from a closed workbook into an open workbook

4. Opening/closing workbook from UserForm in another workbook

5. Closing 1 workbook closes all workbooks

6. Outlook form open automatically with single left click?

7. Can't open workbook from vb6 dll

8. Msgbox while opening excel workbook from VB6

9. Opening multiple worksheets in a single workbook

10. Opening several text files into a single Workbook


 
Powered by phpBB® Forum Software © phpBB Group