Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm trying to close one specific workbook that I've opened with the Workbooks.Add command. This causes the workbook to come up with a name that changes (book1, book2, etc.). After the rest of the code has finished, I want to close this one workbook, leaving all other active workbooks open. I've been trying to work with Workbooks.Close but that keeps closing all workbooks. So the next thing I tried went like this. Sub OpenandClose() Dim wB as String wB = "WorkBook" Workbooks(wB).Add 'rest of code Workbooks(wB).close End Sub But that's not working either - getting error 9, subscript out of range on Workbooks(wB).Add Any thoughts? Thanks in advance for any help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Closing Hidden Workbook when Active Workbook is Closed | Excel Programming | |||
Help with closing down a workbook?? | Excel Worksheet Functions | |||
Closing a workbook... | Excel Programming | |||
closing excel after closing a workbook | Excel Programming | |||
displaying varying toolbars depending on workbook | Excel Programming |