Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting a macro via automation
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01286200
Message ID:
01286572
Views:
21
This message has been marked as the solution to the initial question of the thread.
When i write this example I supposed that it's unknown where is the macro
resides
and code of example provide way to delete the concrete macro.

You can remove the whole module if it is empty with the following
lines of code:
if loVBProject.VBComponents("here_must_be_name_of module").CodeModule.CountOfLines<1
   loVBProject.VBComponents.Remove(loVBProject.VBComponents("here_must_be_name_of module"))
endif
"here_must_be_name_of module" may be "Module1" etc.

if you have a question - don't hesitate to ask :)



>OK, I am getting somewhere! All the three macro sub()'s are being deleted (yea). However, the module that held the macros (default is Module1 unless I name it) is left behind. So when the user opens the excel spreadsheet it still gives that Macro Security error dialog (even though there are no individual macros in there). I think if I can delete the module name then all will be right with the world.
>
>Is there a way to delete the module name? Thinking about it, if I can just delete the module, I wonder if all the macros inside will disappear, too?
>
>Thanks in advance, you have been a big help!!!!
>
>Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform