Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Macro to delete Macro

I want to create a macro X that will delete another macro Y - assume macro X
is stored in the Personal Macro Workbook & macro Y is stored in the currently
active workbook. What is the code to delete a macro?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Macro to delete Macro

Have a look at Chip Pearson's website:
http://www.cpearson.com/excel/vbe.htm

RBS

"Lynn" wrote in message
...
I want to create a macro X that will delete another macro Y - assume macro
X
is stored in the Personal Macro Workbook & macro Y is stored in the
currently
active workbook. What is the code to delete a macro?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro to delete Macro

Here is some code that deletes myProc from Module1

Sub DeleteProcedure()
Const vbext_pk_Proc = 0
Dim oCodeModule As Object
Dim iStart As Long
Dim cLines As Long

Set oCodeModule =
ThisWorkbook.VBProject.VBComponents("Module1").Cod eModule
With oCodeModule
iStart = .ProcStartLine("myProc", 0)
cLines = .ProcCountLines("myProc", 0)
.DeleteLines iStart, cLines
End With

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lynn" wrote in message
...
I want to create a macro X that will delete another macro Y - assume macro

X
is stored in the Personal Macro Workbook & macro Y is stored in the

currently
active workbook. What is the code to delete a macro?



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
Macro warning - how to delete macro GavinS Excel Worksheet Functions 3 April 1st 09 01:45 PM
delete a macro that isn't in macro list Jane Makinson Excel Discussion (Misc queries) 3 March 13th 06 01:10 PM
How can I delete a macro when the Delete button is not active? FCR Excel Worksheet Functions 0 March 9th 06 09:43 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM


All times are GMT +1. The time now is 06:02 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"