How to run auto-open macro in Excel 2007?

Discussion in 'Microsoft Excel Programming' started by jeh, Jan 23, 2010.

  1. jeh

    jeh Guest

    For years I've been using an Excel 2000 workbook (under Win XP)
    containing several macros, one of which is auto-opened at launch. (It
    performs necessary date checks). Security has been set so that before
    the workbook opens I get a warning text box asking me if I want to
    enable or disable macros.

    I've just ported the workbook to Office 2007 in a new computer running
    Win 7 Pro. With this system I find that when the workbook opens (in
    compatibilty mode), the current worksheet and the warning bar about
    macros appear simultaneously. I can accept or reject macro operation
    as I wish, but even if I accept it the auto-open macro hasn't run. Any
    ideas how to get round this? I'm in unfamiliar territory with no
    previous experience of Win 7 and not much of Office 2007. Have I just
    missed something simple?

    I can't use self-signed certificates because the workbook will be used
    on more than one computer.

    TIA John
     
    jeh, Jan 23, 2010
    #1
    1. Advertisements

  2. I don't use win7, but I've never experienced any problems with my auto_open or
    workbook_open procedures that were written in xl97 to xl2003 when opened in
    xl2007.

    I allow macros to run and they fire successfully.

    Maybe it's the macro itself????

    Could you add a
    msgbox "Running"
    as the first line inside the code--just to see if the code actually starts???

    jeh wrote:
    >
    > For years I've been using an Excel 2000 workbook (under Win XP)
    > containing several macros, one of which is auto-opened at launch. (It
    > performs necessary date checks). Security has been set so that before
    > the workbook opens I get a warning text box asking me if I want to
    > enable or disable macros.
    >
    > I've just ported the workbook to Office 2007 in a new computer running
    > Win 7 Pro. With this system I find that when the workbook opens (in
    > compatibilty mode), the current worksheet and the warning bar about
    > macros appear simultaneously. I can accept or reject macro operation
    > as I wish, but even if I accept it the auto-open macro hasn't run. Any
    > ideas how to get round this? I'm in unfamiliar territory with no
    > previous experience of Win 7 and not much of Office 2007. Have I just
    > missed something simple?
    >
    > I can't use self-signed certificates because the workbook will be used
    > on more than one computer.
    >
    > TIA John


    --

    Dave Peterson
     
    Dave Peterson, Jan 23, 2010
    #2
    1. Advertisements

  3. jeh

    jeh Guest

    Thanks Dave. Problem fixed. The auto-open macro does run as soon
    once Macros are enabled. I was fooled by the worksheet appearing
    before I could enable macros, the opposite of the sequence in xl2k.

    John.



    On Jan 24, 1:07 am, Dave Peterson <> wrote:
    > I don't use win7, but I've never experienced any problems with my auto_open or
    > workbook_open procedures that were written in xl97 to xl2003 when opened in
    > xl2007.
    >
    > I allow macros to run and they fire successfully.
    >
    > Maybe it's the macro itself????
    >
    > Could you add a
    > msgbox "Running"
    > as the first line inside the code--just to see if the code actually starts???
    >
    >
    >
    >
    >
    > jeh wrote:
    >
    > > For years I've been using an Excel 2000 workbook (under Win XP)
    > > containing several macros, one of which is auto-opened at launch.  (It
    > > performs necessary date checks).  Security has been set so that before
    > > the workbook opens I get a warning text box asking me if I want to
    > > enable or disable macros.

    >
    > > I've just ported the workbook to Office 2007 in a new computer running
    > > Win 7 Pro.  With this system I find that when the workbook opens (in
    > > compatibilty mode), the current worksheet and the warning bar about
    > > macros appear simultaneously.  I can accept or reject macro operation
    > > as I wish, but even if I accept it the auto-open macro hasn't run. Any
    > > ideas how to get round this?  I'm in unfamiliar territory with no
    > > previous experience of Win 7 and not much of Office 2007.  Have I just
    > > missed something simple?

    >
    > > I can't use self-signed certificates because the workbook will be used
    > > on more than one computer.

    >
    > > TIA   John

    >
    > --
    >
    > Dave Peterson- Hide quoted text -
    >
    > - Show quoted text -
     
    jeh, Jan 23, 2010
    #3
  4. jeh

    Chip Pearson Guest

    Just as a side note, the Auto_Open procedure (indeed all the Auto
    procedures) does not run if the workbook is opened via code. For
    example,

    Dim WB As Workbook
    Set WB = Workbooks.Open("C:\Test.xls")

    The Auto_Open proc of C:\Test.xls will not be executed. You must call
    it yourself if it needs to run:

    WB.RunAutoMacros xlAutoOpen

    Cordially,
    Chip Pearson
    Microsoft MVP 1998 - 2010
    Pearson Software Consulting, LLC
    www.cpearson.com
    [email on web site]




    On Sat, 23 Jan 2010 14:05:25 -0800 (PST), jeh
    <> wrote:

    >Thanks Dave. Problem fixed. The auto-open macro does run as soon
    >once Macros are enabled. I was fooled by the worksheet appearing
    >before I could enable macros, the opposite of the sequence in xl2k.
    >
    >John.
    >
    >
    >
    >On Jan 24, 1:07 am, Dave Peterson <> wrote:
    >> I don't use win7, but I've never experienced any problems with my auto_open or
    >> workbook_open procedures that were written in xl97 to xl2003 when opened in
    >> xl2007.
    >>
    >> I allow macros to run and they fire successfully.
    >>
    >> Maybe it's the macro itself????
    >>
    >> Could you add a
    >> msgbox "Running"
    >> as the first line inside the code--just to see if the code actually starts???
    >>
    >>
    >>
    >>
    >>
    >> jeh wrote:
    >>
    >> > For years I've been using an Excel 2000 workbook (under Win XP)
    >> > containing several macros, one of which is auto-opened at launch.  (It
    >> > performs necessary date checks).  Security has been set so that before
    >> > the workbook opens I get a warning text box asking me if I want to
    >> > enable or disable macros.

    >>
    >> > I've just ported the workbook to Office 2007 in a new computer running
    >> > Win 7 Pro.  With this system I find that when the workbook opens (in
    >> > compatibilty mode), the current worksheet and the warning bar about
    >> > macros appear simultaneously.  I can accept or reject macro operation
    >> > as I wish, but even if I accept it the auto-open macro hasn't run. Any
    >> > ideas how to get round this?  I'm in unfamiliar territory with no
    >> > previous experience of Win 7 and not much of Office 2007.  Have I just
    >> > missed something simple?

    >>
    >> > I can't use self-signed certificates because the workbook will be used
    >> > on more than one computer.

    >>
    >> > TIA   John

    >>
    >> --
    >>
    >> Dave Peterson- Hide quoted text -
    >>
    >> - Show quoted text -
     
    Chip Pearson, Jan 23, 2010
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darin Kramer

    Macro to run or not run a second Macro

    Darin Kramer, Dec 2, 2004, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    377
    Frank Kabel
    Dec 2, 2004
  2. Guest
    Replies:
    0
    Views:
    412
    Guest
    Mar 10, 2005
  3. open up an excel program with an auto open macro

    , Jul 17, 2005, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    205
    Bob Umlas
    Jul 17, 2005
  4. MBais

    Auto-open Excel and run macro

    MBais, Jul 28, 2005, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    225
    Guest
    Jul 28, 2005
  5. Guest

    Auto-run macro after auto-query refresh (Excel2000,sr1)

    Guest, May 8, 2006, in forum: Microsoft Excel Programming
    Replies:
    3
    Views:
    1,044
    Dave Peterson
    Jun 29, 2006
Loading...

Share This Page