View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default Protecting macro code programatically

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