![]() |
Remove ThisWorkbook code via VBA
Using a macro, is it possible to remove the VBA code that exist in
ThisWorkbook? Thanks, Paul |
Remove ThisWorkbook code via VBA
Paul,
Try something like With ThisWorkbook.VBProject.VBComponents("ThisWorkbook" ).CodeModule .DeleteLines 1, .CountOfLines End With -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "PCLIVE" wrote in message ... Using a macro, is it possible to remove the VBA code that exist in ThisWorkbook? Thanks, Paul |
Remove ThisWorkbook code via VBA
Thats's perfect!
Thanks, Paul "Chip Pearson" wrote in message ... Paul, Try something like With ThisWorkbook.VBProject.VBComponents("ThisWorkbook" ).CodeModule .DeleteLines 1, .CountOfLines End With -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "PCLIVE" wrote in message ... Using a macro, is it possible to remove the VBA code that exist in ThisWorkbook? Thanks, Paul |
Remove ThisWorkbook code via VBA
Paul,
Give this a whirl Function DeleteModule() Dim vbMod As Object Set vbMod = ActiveWorkbook.VBProject.VBComponents("ThisWorkboo k") With vbMod.CodeModule .DeleteLines 1, .CountOfLines End With End Function -- HTH RP (remove nothere from the email address if mailing direct) "PCLIVE" wrote in message ... Using a macro, is it possible to remove the VBA code that exist in ThisWorkbook? Thanks, Paul |
All times are GMT +1. The time now is 12:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com