简体   繁体   中英

VBA Macro changing macro

Is it possible to create a macro in MS Office (in this case Word) that will change other macro code? I was trying to find information but no results.

I have a doc which works as a template. Content of template is changed and then saved to another file. However it is important to have current date in it. It cannot be self-updated. Those docs go to folder of people and it is important to know when they get the document, so it must be simply data (or something that does not update).

I was thinking about an on-start event macro that would input current date and on exit it would ask "Do you want self-update functionality" Yes / No

If Yes, delete that event. However I have no idea if it is possible. If it is I still don't know how to search for it.

No this is not possible. In VBA, unlike some lower level languages when you define an event you can not disable it, even using other VBA code.

In C# or VB.NET, Java or C++ you can disable an event by un-wiring it from the handler, but this is not possible in VBA.

Maybe if you be more clear on what you need I can give you a better answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM