Excel Workbook Open Event macro doesn't always run

后端 未结 10 572
刺人心
刺人心 2020-12-11 04:23

I\'ve got a Workbook_Open event macro (and it\'s in ThisWorkbook) that doesn\'t always run.

  • If Excel is closed and I double-click the .xls file from Windows Ex
相关标签:
10条回答
  • 2020-12-11 04:27

    This happens when a workbook is closed with an Application.EnableEvents set to false, and then you open another workbook within the same instance of excel opened. To avoid this, make sure that all of your processes that disable events, reenable them before terminating. Special attention to "End" commands, error handlers and "exit sub" sentences in the middle of your program.

    0 讨论(0)
  • 2020-12-11 04:30

    A few suggestions:

    1. Try signing the workbook with a digital certificate. Add this certificate to the Trusted Certificates store then try again.
    2. If this is machine-specific, try re-installing Office.

    Make sure you have the latest service pack(s) applied.

    0 讨论(0)
  • 2020-12-11 04:30

    I encountered the same problem, and I avoid it using the security settings. I use the options settings then confidentiality center, then "params of confidentiality center" (sorry but its a translation of the french version :-p) then "files approuved" or something like this. And add the file containing the excel workbook in. And its finnaly worked after that.

    Looked everywhere and never find that solution.

    Hope it'll help someone

    0 讨论(0)
  • 2020-12-11 04:31

    A late answer (better than none).

    I've had this problem now a few times (with Excel 2010). The solution that has always worked (so far) was: remove conditional formatting, in particular if it contains UDF as conditions. As @LanceRoberts wrote in an above post, it's ultimately due to UDF calculations "overriding" the Open event, but I've found that those are particularly harmful if used in conditional formats.

    0 讨论(0)
  • I experienced the same problem.

    I tested a workbook on my computer without any troubles. After destributing it to my customers I was told, that some combo-boxes stayed empty. These are usually filled from inside the workbook_open routine. I tried different things to enable the workbook_open-Event - without success.

    Finally, I found that disabling all userdefined Functions (UDF) lead to correct execution of workbook_open.

    As my workbook is opened from another file, I will try to set calculation to manual first and then run the workbook_open manually. This may be done by defining it

    public sub workbook_open
    

    instead of

    private sub workbook_open
    

    Strange, that excel does not time this by itself...

    0 讨论(0)
  • 2020-12-11 04:37

    This happened to me also and took me hours to figure out.

    Turns out the TODAY() function in Excel was causing the problem. Once deleted from my worksheet everything worked again. Very strange bug.

    0 讨论(0)
提交回复
热议问题