Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I stop blank workbook from opening when opening an existing | Excel Discussion (Misc queries) | |||
when opening an Excel Workbook, another blank workbook also opens | Excel Discussion (Misc queries) | |||
excel VBA problem - setting workbook as variable & opening/re-opening | Excel Programming | |||
How to make the opening of a workbook conditional upon the opening of another workbook | Excel Programming | |||
How to make opening of workbook conditional of opening of another workbook | Excel Programming |