Results 1 to 14 of 14
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Launch Method (2003/SP2)

    Is there any way to determine (using VBA) whether
    <UL><LI>Excel was open at the time a given workbook was opened, or
    <LI>Excel was launched as a consequence of opening the workbook?[/list]T.I.A.
    Regards
    Don

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Launch Method (2003/SP2)

    Not that I know of - why?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Launch Method (2003/SP2)

    Not as far as I know.

  4. #4
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Launch Method (2003/SP2)

    Hi Rory
    Thanks for the feedback.
    I have a project that requires the macro container to be located in a specicic folder structure. Since the file is passed from company to company as part of a reporting scheme, this structure may reside on any drive or server.
    As part of the Auto_Open procedure, the code tests for the appropriate folder structure--at least it is supposed to. However when operating from a server, if Excel has not been launched prior to opening the workbook, the code fails to recognize that the workbook is located in an acceptable file structure.
    Although I have advised the users to launch Excel first, they forget. I don't want to institute a nag message unnecessarily; hence the original query.
    Regards
    Don

  5. #5
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Launch Method (2003/SP2)

    Well; at least now I know. Thank you Hans.
    Regards
    Don

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Launch Method (2003/SP2)

    Obviously hard to be specific at this point, but have you tried using Application.OnTime to launch the check after Excel has finished all its start up operations? It sounds like it's probably a timing issue to me.
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Launch Method (2003/SP2)

    Haven't tried it yet, but be certain that I will.
    Regards
    Don

  8. #8
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Launch Method (2003/SP2)

    Thanks again for the feedback Rory.
    The mystery has been solved.
    The problematic user had their Personal workbook unhidden. My code minimized ActiveWorkbook expecting it to remain active; of course it didn't, and consequently, the code began gathering information from the wrong file. I can only assume that she was in the habit of minimizing the Personal workbook after launching Excel.
    The lesson I have gained: Take nothing for granted!
    Regards
    Don

  9. #9
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Launch Method (2003/SP2)

    If you need to use a specific workbook, never use ActiveWorkbook! If it's the workbook with the code in, use ThisWorkbook, otherwise refer to it specifically. You will save yourself a lot of headaches that way!! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Regards,
    Rory

    Microsoft MVP - Excel

  10. #10
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Launch Method (2003/SP2)

    Too soon we get old--Too late we get smart.
    Regards
    Don

  11. #11
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Launch Method (2003/SP2)

    Personally, I'm great at the theory, but lousy at the practice! <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Hence the efficiency of my backup routine at home...
    Regards,
    Rory

    Microsoft MVP - Excel

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Launch Method (2003/SP2)

    In theory, there is no difference between theory and practice. In practice, there is...

  13. #13
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Launch Method (2003/SP2)

    So theoretically, I'm great? I'll leave it at that! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Regards,
    Rory

    Microsoft MVP - Excel

  14. #14
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Launch Method (2003/SP2)

    Hans
    I doubt you could translate that statement into an Excel function without getting an error message (something about circular references). <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>
    Regards
    Don

Posting Permissions

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