Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open file bypasses Auto_Open
I have the following code.
Workbooks.Open Filename:=vOpen, UpdateLinks:=3 But when I run this it does not process the macro Auto_Open. Why is this? I would like for code to run on the opening of the file regardless of how the user opened it. (ie. If they opened it using File / Open on the menu then yes, the Auto_Open would run. But I also want code to run even if they write their own macro to open it.) Thank you, Steven |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open file bypasses Auto_Open
That's the way excel was designed to work.
Lots of times, developers want to open the workbook without having that macro run (maybe they're automating something and want to avoid some msgbox/inputbox in that auto_open procedure. But MS did give you a way to run that procedure. dim wkbk as workbook set wkbk = workbooks.open(filename:=vopen, updatelinks:=3) wkbk.RunAutoMacros which:=xlAutoOpen (there are other options for the Which parm, too--see VBA's help for RunAutoMacros). Interestly (well, maybe <bg), MS does the opposite with the Workbook_Open event. That runs unless you stop it. dim wkbk as workbook application.enableevents = false set wkbk = workbooks.open(filename:=vopen, updatelinks:=3) application.enableevents = true Steven wrote: I have the following code. Workbooks.Open Filename:=vOpen, UpdateLinks:=3 But when I run this it does not process the macro Auto_Open. Why is this? I would like for code to run on the opening of the file regardless of how the user opened it. (ie. If they opened it using File / Open on the menu then yes, the Auto_Open would run. But I also want code to run even if they write their own macro to open it.) Thank you, Steven -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open file bypasses Auto_Open
Never mind. I think this was an EnableEvents issue. Regards, Steven "Steven" wrote: I have the following code. Workbooks.Open Filename:=vOpen, UpdateLinks:=3 But when I run this it does not process the macro Auto_Open. Why is this? I would like for code to run on the opening of the file regardless of how the user opened it. (ie. If they opened it using File / Open on the menu then yes, the Auto_Open would run. But I also want code to run even if they write their own macro to open it.) Thank you, Steven |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open file bypasses Auto_Open
Hi,
a simple example of a code you could use in your file to open http://cjoint.com/?bjfjH1n6v0 "Steven" a écrit dans le message de groupe de discussion : ... I have the following code. Workbooks.Open Filename:=vOpen, UpdateLinks:=3 But when I run this it does not process the macro Auto_Open. Why is this? I would like for code to run on the opening of the file regardless of how the user opened it. (ie. If they opened it using File / Open on the menu then yes, the Auto_Open would run. But I also want code to run even if they write their own macro to open it.) Thank you, Steven |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open file bypasses Auto_Open
Not if you were really using Auto_Open.
Steven wrote: Never mind. I think this was an EnableEvents issue. Regards, Steven "Steven" wrote: I have the following code. Workbooks.Open Filename:=vOpen, UpdateLinks:=3 But when I run this it does not process the macro Auto_Open. Why is this? I would like for code to run on the opening of the file regardless of how the user opened it. (ie. If they opened it using File / Open on the menu then yes, the Auto_Open would run. But I also want code to run even if they write their own macro to open it.) Thank you, Steven -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
with a macro open a workbook without the Auto_Open running | Excel Programming | |||
Workbook Open bypasses Query Refresh | Excel Programming | |||
Macro runs upon wkbk open, but no Workbook_Open or Auto_Open Macro | Excel Programming | |||
Auto_Open only on initial file open | Excel Programming | |||
Auto_Open vs Open and call macro --priority question | Excel Programming |