Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How do we code in VBA to close the current workbook and load another specifed one? For example, I am currently in ABC.xls and I wish to close this workbook and load DEF.xls.... -- Regards, Adrian |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Activeworkbook.Close Workbooks.Open filename:="C:\myDir\DEF.xls" -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Adrian" wrote in message ... Hi, How do we code in VBA to close the current workbook and load another specifed one? For example, I am currently in ABC.xls and I wish to close this workbook and load DEF.xls.... -- Regards, Adrian |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob Phillips wrote
Activeworkbook.Close Workbooks.Open filename:="C:\myDir\DEF.xls" Will the second line really execute if the calling file is closed? -- David |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the code isn't in the activeworkbook, it'll work ok.
(I'm guessing that there's a 3rd workbook controlling the action.) David wrote: Bob Phillips wrote Activeworkbook.Close Workbooks.Open filename:="C:\myDir\DEF.xls" Will the second line really execute if the calling file is closed? -- David -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Adrian,
Try something like Sub AAA() Workbooks.Open "DEF.xls" Workbooks("ABC.xls").Close savechanges:=True End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Adrian" wrote in message ... Hi, How do we code in VBA to close the current workbook and load another specifed one? For example, I am currently in ABC.xls and I wish to close this workbook and load DEF.xls.... -- Regards, Adrian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Workbook wont load from shortcut | Excel Discussion (Misc queries) | |||
Load form when workbook opens | Excel Discussion (Misc queries) | |||
Copy a range of cells in an unopened workbook and paste it to the current workbook | Excel Programming | |||
Transparently updating another workbook from the current workbook | Excel Programming | |||
Close current Workbook after calling macro in other | Excel Programming |