Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
pm
 
Posts: n/a
Default programming VBE - Deleting All Code From A Module

hello,

i have a file remove.xls in which i use such a code:

Sub DeleteAllCodeInModule()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long

Set VBCodeMod = Workbooks("new.xls").VBProject.VBComponents("Sheet s4").CodeModule
With VBCodeMod
StartLine = 1
HowManyLines = .CountOfLines
.DeleteLines StartLine, HowManyLines
End With

End Sub

to remove Private Sub Worksheet_Calculate() in new.xls

than i save and close file, but on reopening new.xls an information about
existing macros is appears and i do not know why?
there is no VBA code in file. i checked carefully other sheets and ThisWorkbook
and they are empty...

does somebody has any idea what is going on? i use office xp..

regards
peter
  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
Ron de Bruin
 
Posts: n/a
Default programming VBE - Deleting All Code From A Module

Hi Pm

You must delete the empty module also
http://www.contextures.com/xlfaqMac.html#NoMacros


--
Regards Ron de Bruin
http://www.rondebruin.nl


"pm" wrote in message ...
hello,

i have a file remove.xls in which i use such a code:

Sub DeleteAllCodeInModule()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long

Set VBCodeMod = Workbooks("new.xls").VBProject.VBComponents("Sheet s4").CodeModule
With VBCodeMod
StartLine = 1
HowManyLines = .CountOfLines
.DeleteLines StartLine, HowManyLines
End With

End Sub

to remove Private Sub Worksheet_Calculate() in new.xls

than i save and close file, but on reopening new.xls an information about
existing macros is appears and i do not know why?
there is no VBA code in file. i checked carefully other sheets and ThisWorkbook
and they are empty...

does somebody has any idea what is going on? i use office xp..

regards
peter



  #3   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
pm
 
Posts: n/a
Default programming VBE - Deleting All Code From A Module

Ron de Bruin wrote:

Hi Pm

You must delete the empty module also
http://www.contextures.com/xlfaqMac.html#NoMacros


sure ;) but as i wrote i run deleting macro from other file
(remove.xls) in order to delete private sub code in sheets
in new.xls (which is one existing code in this file)

in new.xls there is only 1 code in Sheets4. no free modules

btw he http://miodek.no-ip.org/~prob/PL_1000_21-12-2005.xls
you can find such a file after deleting private sub from
Sheets5 (revenues), but on when file is opening a warning about
macros occurs... find a VBA code in this file, get beer ;)
  #4   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
Ken Wright
 
Posts: n/a
Default programming VBE - Deleting All Code From A Module

When you open that file via the link provided you are prompted with the
macro warning, but once you have saved down the file, closed it and then
reopened it there is no more warning after that.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"pm" wrote in message ...
Ron de Bruin wrote:

Hi Pm

You must delete the empty module also
http://www.contextures.com/xlfaqMac.html#NoMacros


sure ;) but as i wrote i run deleting macro from other file
(remove.xls) in order to delete private sub code in sheets
in new.xls (which is one existing code in this file)

in new.xls there is only 1 code in Sheets4. no free modules

btw he http://miodek.no-ip.org/~prob/PL_1000_21-12-2005.xls
you can find such a file after deleting private sub from
Sheets5 (revenues), but on when file is opening a warning about
macros occurs... find a VBA code in this file, get beer ;)



  #5   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
pm
 
Posts: n/a
Default programming VBE - Deleting All Code From A Module

Ken Wright wrote:

When you open that file via the link provided you are prompted with the
macro warning, but once you have saved down the file, closed it and then
reopened it there is no more warning after that.


;)
so, this is the answer..

thank you
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
regular code module billy boy Excel Discussion (Misc queries) 4 December 13th 05 07:30 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
Change case...help please Terry Excel Worksheet Functions 14 October 2nd 05 12:29 PM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM


All times are GMT +1. The time now is 09:33 AM.

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"