开发者

How to call user define function when excel sheet being opened

开发者 https://www.devze.com 2022-12-22 21:55 出处:网络
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 function

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消