LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default programatically deleted code still triggers macro warning

I am using code posted by Chip Pearson to programatically delete a
button and its associated code. The file from which the button and
code are deleted is then saved and automatically inserted into an e-
mail. When the attached file is opened directly from the e-mail
(which the receiving customer will necessarily do) the macro warning
still appears. The button code appears to be gone and when I try to
clean the project with Rob Bovey's slick code cleaner, the file from
which I have deleted the code does not show up as an option, which I
believe indicates that there is no code. Also, if I save the file and
reoopen it, I do not get the macro warning on the second opening.

The code I am using is to delete the code is:

Set WS = Workbooks(nWB).Worksheets("Quote")

With WS
.OLEObjects(CommandButtonName).Delete
Set CodeMod =
Workbooks(nWB).VBProject.VBComponents(.CodeName).C odeModule
End With

With CodeMod
.DeleteLines StartLine:=1, Count:=.CountOfLines
End With

When the whole routing is completed the button is gone and the code no
longer appears; but, I get the macro warning.

Is there something else I need to add to make it understand that once
this is accomplished there is no more code and therefore no need to
prompt the user with the macro warning?

Thanks

Ken

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX warning after control is deleted [email protected] Excel Programming 2 August 29th 07 02:46 PM
Code & modules are gone, Macro warning message remains David McRitchie Excel Programming 1 September 10th 04 11:17 PM
Deleting macro code programatically Terry Lowe[_3_] Excel Programming 1 September 1st 04 02:30 AM
getting a macro warning, even through there is no code Sandy[_5_] Excel Programming 4 November 15th 03 03:15 PM
code for lookup,& triggers. derek Excel Programming 3 July 22nd 03 05:04 AM


All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"