Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All
I have a group of workbooks, each with a routine in the Auto_Open event. Upon opening the routine is executed and the workbook is saved (Using Workbooks("....").Close, True) I have written a routine in a seperate parent workbook to take care of opening these in sequence. I have discovered that if you do not save the child workbooks then everything runs OK. However, if you exit the child workbooks and save them, the routine in the parent workbook halts. Is there a way around this Thanks Matt |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Matt,
A bit confused as to whether you are opening or closing. Is it the closing that is failing because they have already been saved? If so, you could try something like On Error Resume Next Set oWB = Workbooks("file1.xls") If Not oWB Is Nothing Then Workbooks("file1.xls").Close ,True End If 'etc. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Matt" wrote in message ... Hi All, I have a group of workbooks, each with a routine in the Auto_Open event. Upon opening the routine is executed and the workbook is saved (Using Workbooks("....").Close, True) I have written a routine in a seperate parent workbook to take care of opening these in sequence. I have discovered that if you do not save the child workbooks then everything runs OK. However, if you exit the child workbooks and save them, the routine in the parent workbook halts. Is there a way around this? Thanks, Matt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry (That confused me too when I read it back
I have a main workbook and it has a routine which opens other workbooks in sequence Workbooks.open("Workbook1" Workbooks.Open("Workbook2") et In the Open event of each of these workbooks is a routine. If you don't put code to close/save these workbooks at the end of the routine then each workbook opens OK. If you place code to close and save the workbooks at the end of the routine then the routine in the main book doesn't go any further. Thanks Matt |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Matt,
I see what you mean now. When the called WB closes, the code thread is lost with it, so the original code does not continue. Don't think there is much you can do about that other move the code that is in the child workbooks from the Workbook_Open event to an Auto_Open macro because Auto_open doesn't fire when a workbook is opened from code. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Matt" wrote in message ... Sorry (That confused me too when I read it back) I have a main workbook and it has a routine which opens other workbooks in sequence. Workbooks.open("Workbook1") Workbooks.Open("Workbook2") etc In the Open event of each of these workbooks is a routine. If you don't put code to close/save these workbooks at the end of the routine then each workbook opens OK. If you place code to close and save the workbooks at the end of the routine then the routine in the main book doesn't go any further. Thanks, Matt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Opening new workbooks | Excel Discussion (Misc queries) | |||
combine several workbooks without opening | Excel Discussion (Misc queries) | |||
Opening workbooks | Excel Discussion (Misc queries) | |||
Opening Workbooks Mininmized | New Users to Excel | |||
run macro on opening of workbooks | Excel Programming |