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