+ Reply to Thread
Results 1 to 3 of 3

Does Workbook.Open ever run from a Function Call?

  1. #1
    Mac Lingo
    Guest

    Does Workbook.Open ever run from a Function Call?

    I have code that opens a Workbook.

    When this code runs in Workbook_Open() it works fine. However when I
    execute the same code in a normal Function call it doesn't work.

    I have moved the code that does the actual opening of the workbook to a
    different subroutine "Test_Call". When I call it from Workbook_Open, it
    works. When I call it from a Function Call, it doesn't work. When I put
    the call to "Test_Call" into a Macro, it works.

    Do you have any idea what's going on?

    Mac Lingo



  2. #2
    Jim Rech
    Guest

    Re: Does Workbook.Open ever run from a Function Call?

    If you're calling the function via a worksheet formula it will not work.
    Formulas only return a value to the cell they are in. They cannot affect
    other cells or perform any actions.

    --
    Jim
    "Mac Lingo" <[email protected]> wrote in message
    news:[email protected]...
    >I have code that opens a Workbook.
    >
    > When this code runs in Workbook_Open() it works fine. However when I
    > execute the same code in a normal Function call it doesn't work.
    >
    > I have moved the code that does the actual opening of the workbook to a
    > different subroutine "Test_Call". When I call it from Workbook_Open, it
    > works. When I call it from a Function Call, it doesn't work. When I put
    > the call to "Test_Call" into a Macro, it works.
    >
    > Do you have any idea what's going on?
    >
    > Mac Lingo
    >
    >




  3. #3
    Bob Phillips
    Guest

    Re: Does Workbook.Open ever run from a Function Call?

    If you are calling form a VBA function, either

    a) precede the call by thisworkbook, e.g. thisworkbook.workbook_open
    b) move the code to a procedure in a normal code module and call that (from
    the Workbook_Open as well)

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Jim Rech" <[email protected]> wrote in message
    news:[email protected]...
    > If you're calling the function via a worksheet formula it will not work.
    > Formulas only return a value to the cell they are in. They cannot affect
    > other cells or perform any actions.
    >
    > --
    > Jim
    > "Mac Lingo" <[email protected]> wrote in message
    > news:[email protected]...
    > >I have code that opens a Workbook.
    > >
    > > When this code runs in Workbook_Open() it works fine. However when I
    > > execute the same code in a normal Function call it doesn't work.
    > >
    > > I have moved the code that does the actual opening of the workbook to a
    > > different subroutine "Test_Call". When I call it from Workbook_Open, it
    > > works. When I call it from a Function Call, it doesn't work. When I

    put
    > > the call to "Test_Call" into a Macro, it works.
    > >
    > > Do you have any idea what's going on?
    > >
    > > Mac Lingo
    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1