Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Remove All Macros

No, that doesn't remove the modules. This link should get you going.

http://www.cpearson.com/excel/vbe.htm

--
Regards,
Tom Ogilvy



"Steve" wrote in message
ups.com...

The code i found was the one as follows, im a bit of a VBA novice as
you probably guessed!

Sub removeAllCode()
Dim awi 'activeWorkbookItem(index)
Dim awcl As Integer 'activeWorkbook Component CountOfLines
Dim count As Integer 'how many potential code modules
Dim i As Integer 'loop counter
On Error Resume Next
count = ActiveWorkbook.VBProject.VBComponents.count
For i = 1 To count
Set awi = ActiveWorkbook.VBProject.VBComponents.Item(i)
awcl = awi.CodeModule.CountOfLines
awi.CodeModule.DeleteLines 1, awcl
Next i
Set awi = Nothing ' Release the object
End Sub





Tom Ogilvy wrote:

does the code to remove the macros also remove the modules? If not, you
will
get that prompt. (for general modules). for sheet modules you will need
to
make sure they are completely empty - no spaces left or anything like
that.

--
Regards,
Tom Ogilvy


"Steve" wrote:

Hi All,

I have an excel spreadsheet that runs a macro on opening and then
within the workbook there are various buttons running further macros
(i.e. to delete rows etc). After pressing the final button, i want all
evidence of macros to be removed from the sheet. When the sheet is
saved, closed and then reopened, i dont want the macro enable/disable
to appear. Is this possible??

I have found VBA code to remove all macro code, and when looking in
Tools\macros, it appears they have all gone, but after saving, closing
and re-opening, i still get the enable/disable popup, suggesting i
still have macros within the sheet.

Any quick responses will be greatly appreciated, on a tight deadline!!

Many thanks





Reply
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
remove an asigned macros cavalier Excel Discussion (Misc queries) 1 October 20th 08 12:47 AM
How can I remove all traces of XLM macros? keithb Excel Programming 4 September 9th 05 03:59 PM
Remove macros from spreadsheet Jan Buckley Excel Discussion (Misc queries) 1 August 12th 05 08:38 PM
Remove macros on save as Quake Excel Programming 2 October 22nd 04 01:19 PM
Remove Macros from Workbook ostq Excel Programming 3 September 26th 03 06:21 AM


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

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

About Us

"It's about Microsoft Excel"