Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi to the experts in excel programming.
What is the commands or script for deleting a macro automatically using another workbook macro. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ddiicc,
See Chip Pearson VBE programming page at: http://www.cpearson.com/excel/vbe.htm See particularly the section entitled: Deleting A Procedure From A Module --- Regards, Norman "ddiicc" wrote in message ... Hi to the experts in excel programming. What is the commands or script for deleting a macro automatically using another workbook macro. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Norman,
What If I want to delete a module in another workbook 2 using the module in workbook 1... so how should go about writing this in workbook module??? "Norman Jones" wrote: Hi Ddiicc, See Chip Pearson VBE programming page at: http://www.cpearson.com/excel/vbe.htm See particularly the section entitled: Deleting A Procedure From A Module --- Regards, Norman "ddiicc" wrote in message ... Hi to the experts in excel programming. What is the commands or script for deleting a macro automatically using another workbook macro. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ddiicc,
Try: Sub DeleteModule() Dim VBComp As VBComponent Set VBComp = Workbooks("Book2.xls").VBProject. _ VBComponents("NewModule") Workbooks("Book2.xls").VBProject.VBComponents.Remo ve VBComp End Sub --- Regards, Norman "ddiicc" wrote in message ... Hi Norman, What If I want to delete a module in another workbook 2 using the module in workbook 1... so how should go about writing this in workbook module??? "Norman Jones" wrote: Hi Ddiicc, See Chip Pearson VBE programming page at: http://www.cpearson.com/excel/vbe.htm See particularly the section entitled: Deleting A Procedure From A Module --- Regards, Norman "ddiicc" wrote in message ... Hi to the experts in excel programming. What is the commands or script for deleting a macro automatically using another workbook macro. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Norman,
Thanks for responding, I am rather a beginner in macro writing, So I would like to ask on how to add in the code that you given. Eg..My ending of the macros is stated below. ActiveWorkbook.SaveAs Filename:="E:\Jong\Python A HSA\HSA Yield For All Lines 2005\C LGC\All HSA LGC Stations Yield\G Jul 2005 LGC Yield\HSA LGC01 All Model 1st Pass Yield Jul 2005.xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False End Sub So how do I add in the script you have given, I have about 11 modules to delete after the workbook is saved as stated on the above... Regards ddiicc "Norman Jones" wrote: Hi Ddiicc, Try: Sub DeleteModule() Dim VBComp As VBComponent Set VBComp = Workbooks("Book2.xls").VBProject. _ VBComponents("NewModule") Workbooks("Book2.xls").VBProject.VBComponents.Remo ve VBComp End Sub --- Regards, Norman "ddiicc" wrote in message ... Hi Norman, What If I want to delete a module in another workbook 2 using the module in workbook 1... so how should go about writing this in workbook module??? "Norman Jones" wrote: Hi Ddiicc, See Chip Pearson VBE programming page at: http://www.cpearson.com/excel/vbe.htm See particularly the section entitled: Deleting A Procedure From A Module --- Regards, Norman "ddiicc" wrote in message ... Hi to the experts in excel programming. What is the commands or script for deleting a macro automatically using another workbook macro. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ddiicc,
On the link page I gave you, Chip Pearson gives a DeleteAllVBA procedure which 'does what it says on the label'. Customising for your specific workbook, try: Sub DeleteAllVBA() Dim VBComp As VBIDE.VBComponent Dim VBComps As VBIDE.VBComponents Dim WB As Workbook Set WB = Workbooks("HSA LGC01.xls") Set VBComps = WB.VBProject.VBComponents For Each VBComp In VBComps Select Case VBComp.Type Case vbext_ct_StdModule, vbext_ct_MSForm, _ vbext_ct_ClassModule VBComps.Remove VBComp Case Else With VBComp.CodeModule .DeleteLines 1, .CountOfLines End With End Select Next VBComp End Sub '===================================== Before using this code, thank Chip and carefully read the warning he provided for the procedu The procedure below will delete all the VBA code in a project. You should use this procedure with care, as it will permanently delete the code. Standard modules, user forms, and class modules will be removed, and code within the ThisWorkbook module and the sheet modules will be deleted. You may want to export the VBA code, using the procedure above, before deleting the VBA code. '<<===================================== --- Regards, Norman "ddiicc" wrote in message ... Hi Norman, Thanks for responding, I am rather a beginner in macro writing, So I would like to ask on how to add in the code that you given. Eg..My ending of the macros is stated below. ActiveWorkbook.SaveAs Filename:="E:\Jong\Python A HSA\HSA Yield For All Lines 2005\C LGC\All HSA LGC Stations Yield\G Jul 2005 LGC Yield\HSA LGC01 All Model 1st Pass Yield Jul 2005.xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False End Sub So how do I add in the script you have given, I have about 11 modules to delete after the workbook is saved as stated on the above... Regards ddiicc "Norman Jones" wrote: Hi Ddiicc, Try: Sub DeleteModule() Dim VBComp As VBComponent Set VBComp = Workbooks("Book2.xls").VBProject. _ VBComponents("NewModule") Workbooks("Book2.xls").VBProject.VBComponents.Remo ve VBComp End Sub --- Regards, Norman "ddiicc" wrote in message ... Hi Norman, What If I want to delete a module in another workbook 2 using the module in workbook 1... so how should go about writing this in workbook module??? "Norman Jones" wrote: Hi Ddiicc, See Chip Pearson VBE programming page at: http://www.cpearson.com/excel/vbe.htm See particularly the section entitled: Deleting A Procedure From A Module --- Regards, Norman "ddiicc" wrote in message ... Hi to the experts in excel programming. What is the commands or script for deleting a macro automatically using another workbook macro. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete All Macros | Excel Worksheet Functions | |||
delete macros | Excel Discussion (Misc queries) | |||
Delete all macros if workbook is saved with another name | Excel Worksheet Functions | |||
How to delete macros | Excel Discussion (Misc queries) | |||
Open workbook-macros enabled, opening another with macros | Excel Programming |