Prev: Problem with the "Or" operand in Excel
Next: Web pop up
From: ordnance1 on 29 May 2010 13:17 I am just wondering, is there any advantage to using an Auto_Open module over just placing that code in a Private Sub Workbook_Open() module under ThisWorkbook?
From: Dave Peterson on 29 May 2010 22:50 I find that explaining how to use Auto_Open is easier than explaining how to use workbook_open. But to me, they're pretty much interchangeable. There are some things (creating an application event, for example) that makes the workbook_open a more logical choice. And there are differences in behavior. If you use one macro to open another workbook, then you have to stop the workbook_open event from firing (if you don't want it to run) application.enableevents = false set wkbk = workbooks.open(filename:=... application.enableevents = true On the other hand, if you want to run the auto_open procedure, you'll have to run it explicitly (using someworkbookthatjustopened.RunAutoMacros which:=xlAutoOpen.runautomacros They're kind of opposite in behavior. ordnance1 wrote: > > I am just wondering, is there any advantage to using an Auto_Open module > over just placing that code in a Private Sub Workbook_Open() module under > ThisWorkbook? -- Dave Peterson
From: ordnance1 on 29 May 2010 23:00 Thanks "Dave Peterson" <petersod(a)verizonXSPAM.net> wrote in message news:4C01D25B.9CBA7414(a)verizonXSPAM.net... > I find that explaining how to use Auto_Open is easier than explaining how > to use > workbook_open. > > But to me, they're pretty much interchangeable. > > There are some things (creating an application event, for example) that > makes > the workbook_open a more logical choice. > > And there are differences in behavior. > > If you use one macro to open another workbook, then you have to stop the > workbook_open event from firing (if you don't want it to run) > > application.enableevents = false > set wkbk = workbooks.open(filename:=... > application.enableevents = true > > On the other hand, if you want to run the auto_open procedure, you'll have > to > run it explicitly (using someworkbookthatjustopened.RunAutoMacros > which:=xlAutoOpen.runautomacros > > They're kind of opposite in behavior. > > > > ordnance1 wrote: >> >> I am just wondering, is there any advantage to using an Auto_Open module >> over just placing that code in a Private Sub Workbook_Open() module under >> ThisWorkbook? > > -- > > Dave Peterson
|
Pages: 1 Prev: Problem with the "Or" operand in Excel Next: Web pop up |