Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Opening workbooks in sequence

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Opening workbooks in sequence

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Opening workbooks in sequence

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Opening workbooks in sequence

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening new workbooks Falcon248 Excel Discussion (Misc queries) 0 January 22nd 10 07:09 PM
combine several workbooks without opening Trang Excel Discussion (Misc queries) 4 December 3rd 07 09:55 PM
Opening workbooks calimari Excel Discussion (Misc queries) 2 January 24th 06 12:34 AM
Opening Workbooks Mininmized DME New Users to Excel 1 December 1st 04 06:53 PM
run macro on opening of workbooks shaharul[_3_] Excel Programming 0 September 16th 03 02:48 AM


All times are GMT +1. The time now is 07:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"