Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Opening workbook with OpenEvent

Hi All
I have a number of workbooks I wish to extract data from, the extract
routine is in another control workbook that opens each in sequence copies
the data into the control book. My problem is that each of the workbooks I
am opening contains a workbook_open event that loads a userform. (Excel 97).
How do I either prevent the workbook open event happening or close the
userform in the newly opened workbook so that I can copy data and then close
it?


--
Cheers
Nigel




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Opening workbook with OpenEvent

Disable events for as long as you need to:


dim wkbk as workbook
application.enableevents = false
set wkbk = workbooks.open(filename:=...., updatelinks:=???)
'do anything you want
wkbk.close savechanges:=false
application.enableevents = true

If you re-enable events, you could get workbook_beforeclose and worksheet_change
events to fire (which could be a good thing if you want them to fire).

Nigel wrote:

Hi All
I have a number of workbooks I wish to extract data from, the extract
routine is in another control workbook that opens each in sequence copies
the data into the control book. My problem is that each of the workbooks I
am opening contains a workbook_open event that loads a userform. (Excel 97).
How do I either prevent the workbook open event happening or close the
userform in the newly opened workbook so that I can copy data and then close
it?

--
Cheers
Nigel


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Opening workbook with OpenEvent

Many thanks

--
Cheers
Nigel



"Dave Peterson" wrote in message
...
Disable events for as long as you need to:


dim wkbk as workbook
application.enableevents = false
set wkbk = workbooks.open(filename:=...., updatelinks:=???)
'do anything you want
wkbk.close savechanges:=false
application.enableevents = true

If you re-enable events, you could get workbook_beforeclose and

worksheet_change
events to fire (which could be a good thing if you want them to fire).

Nigel wrote:

Hi All
I have a number of workbooks I wish to extract data from, the extract
routine is in another control workbook that opens each in sequence

copies
the data into the control book. My problem is that each of the

workbooks I
am opening contains a workbook_open event that loads a userform. (Excel

97).
How do I either prevent the workbook open event happening or close the
userform in the newly opened workbook so that I can copy data and then

close
it?

--
Cheers
Nigel


--

Dave Peterson



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
How do I stop blank workbook from opening when opening an existing kjg Excel Discussion (Misc queries) 3 February 12th 10 09:36 PM
when opening an Excel Workbook, another blank workbook also opens Gord Dibben Excel Discussion (Misc queries) 0 October 12th 07 09:49 PM
excel VBA problem - setting workbook as variable & opening/re-opening safe Excel Programming 1 August 20th 04 12:22 AM
How to make the opening of a workbook conditional upon the opening of another workbook Marcello do Guzman Excel Programming 1 December 16th 03 06:09 AM
How to make opening of workbook conditional of opening of another workbook turk5555[_2_] Excel Programming 2 December 15th 03 11:07 PM


All times are GMT +1. The time now is 04:48 PM.

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

About Us

"It's about Microsoft Excel"