Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As an example, I would have my macro test for a name constant in the target
workbook. If it does not exist, the default state, then I would run the macro. If it did exits, I would exit silently. Then, where you want to add code to delete that macro, I would set the name constant. -- __________________________________ HTH Bob "Anand Nichkaode" wrote in message ... Sorry, but I am not sure I got you fully. Thanks for the reply "Bob Phillips" wrote: That is not designing around it as I see it, that is still trying to allow dynamic code deletion. By designing around it, I mean add some logic so that the macro won't run in those circumstances, it will still be there, but dormant. -- __________________________________ HTH Bob "Anand Nichkaode" wrote in message ... I know that. And that is why I was trying other approach (refere to the code above). But somehow it doesn't work immediately after insert the macro in the workbook. I even tried Inserting Macro-Save workbook-Close Workbook-Open Workbook-Run Macro approach. It still fails. Not able to identify what is going wrong. Thanks for the help. "Bob Phillips" wrote: Then you are stuck, there is nothing exposed in the VBE object model to allow you to do what you want. Personally, I think that adding/deleting code/controls dynamically is not a good idea, it is better to design around it IMO. -- __________________________________ HTH Bob |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob,
Thanks for the response. Continuing our discussion with Protecting macro code programatically, I have been able do that programatically with SendKeys, but what I observed is that after Checking "Lock Project for viewing" and putting "Password to view project properties" when I close the workbook after saving it somehow Macro code is not password protected. I am doing all this operation from XLAM. I also observed that even after closing the workbook on which I worked on (password protect the macro code) I could see the VBAProject still open in the VB editor. And also I could see the protection in the VBA Project. But when I re-open the workbook, the macro code is not password protected. Any info on this would help me a lot as it is really a blocking issue. Thanks in advance. "Bob Phillips" wrote: As an example, I would have my macro test for a name constant in the target workbook. If it does not exist, the default state, then I would run the macro. If it did exits, I would exit silently. Then, where you want to add code to delete that macro, I would set the name constant. -- __________________________________ HTH Bob "Anand Nichkaode" wrote in message ... Sorry, but I am not sure I got you fully. Thanks for the reply "Bob Phillips" wrote: That is not designing around it as I see it, that is still trying to allow dynamic code deletion. By designing around it, I mean add some logic so that the macro won't run in those circumstances, it will still be there, but dormant. -- __________________________________ HTH Bob "Anand Nichkaode" wrote in message ... I know that. And that is why I was trying other approach (refere to the code above). But somehow it doesn't work immediately after insert the macro in the workbook. I even tried Inserting Macro-Save workbook-Close Workbook-Open Workbook-Run Macro approach. It still fails. Not able to identify what is going wrong. Thanks for the help. "Bob Phillips" wrote: Then you are stuck, there is nothing exposed in the VBE object model to allow you to do what you want. Personally, I think that adding/deleting code/controls dynamically is not a good idea, it is better to design around it IMO. -- __________________________________ HTH Bob |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello there,
i coded a VBA module for Excel that allows to unprotect a VBA project programmatically. Nope, it does NOT break any password. That's, you need the password for the VBA project that you want to unprotect. It's just a different way than the SendKeys method. My method uses win32 messages and timers. HF ;) the link : http://www.twen.name/temp/jb_vbaproj...cker_v1.07.zip |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Very nice piece of work Jérôme! Thanks for donating it to us. It
definitely fills a need. -- Jim <gg67 gg67 wrote in message ... Hello there, i coded a VBA module for Excel that allows to unprotect a VBA project programmatically. Nope, it does NOT break any password. That's, you need the password for the VBA project that you want to unprotect. It's just a different way than the SendKeys method. My method uses win32 messages and timers. HF ;) the link : http://www.twen.name/temp/jb_vbaproj...cker_v1.07.zip |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nice work :-)
But why place the code in "ThisWorkbook" ??? I took the liberty to move the unlocking code to a normal Module, and it works just as well - so, why place it in "ThisWorkbook"? PS: I also took the liberty to add support for Danish in 'Main Settings' as suggested :-) Keep up the great work, CE gg67 gg67 wrote: Hello there, i coded a VBA module for Excel that allows to unprotect a VBA project programmatically. Nope, it does NOT break any password. That's, you need the password for the VBA project that you want to unprotect. It's just a different way than the SendKeys method. My method uses win32 messages and timers. HF ;) the link : http://www.twen.name/temp/jb_vbaproj...cker_v1.07.zip |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
programatically deleted code still triggers macro warning | Excel Programming | |||
protecting macro code | Excel Programming | |||
Deleting macro code programatically | Excel Programming | |||
Hiding/Protecting the code of macro | Excel Programming | |||
protecting macro code | Excel Programming |