How to call user define function when excel sheet being opened
I'm trying to call a function when a workbook is being opened. I used workbook_open() event. But I notice that before calling f开发者_运维问答unction which is inside workbook_open(), all the functions that already exists in the workbook are being called.
How can I call my function to execute before calling any of functions in the workbook?
Thank you
I do not believe that there is a event for this in VBA.
You could add a check to all your other functions, cancelling them if Workbook_Open has not occured yet.
If the functions that you don't want to run are used on the sheets themselves, then you could turn off automatic calculation during the workbook_beforeclose event. Then when you open the workbook you can call the function in the workbook_open event then turn on automatic calculations.
精彩评论