Share via

When does workbook_open event trigger?

Anonymous
2013-06-28T13:54:48+00:00

Hello

I have an Excel workbook which has several calculations in it (it fetches data from a third party application). I want to run a macro in this workbook when I open it. However I want to first complete all calculations in the workbook and then trigger the macro. My question is: When does the workbook_open even trigger? Is it after all calculations are completed or immediately after the workbook opens (calculations and macro run simultaneously).

Thanks for help in advance.

Regards,

Pawan

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2013-06-28T14:47:51+00:00

    Hi

    I believe it calculates before executing the event macro. You could do your  test with a copy of your workbook.

    Here is a small test I did, not sure if this is valid in your case.

    In cell A1, I placed the formula =Now() and formatted as hh:mm:ss. That  giving me a dynamic time.

    Then I type this small macro in a Workbook Open Event

    Private Sub Workbook_Open()

    Range("A1").Copy

    Range("B1").PasteSpecial xlPasteValues

    End Sub

    I waited a few minutes and opened the file, It pasted the new time in cell B1

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-06-28T14:15:03+00:00

    Hi,

    You could do something like this

    Private Sub Workbook_Open()

    Do Until Application.CalculationState = xlDone

       DoEvents

    Loop

    'Your code

    End Sub

    Was this answer helpful?

    0 comments No comments