View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Executing macro in one book from another.

Hi Michael,

I'm attempting to adapt Chip Pearson's code for deleting all code in a
workbook to run from a different workbook.

I've tried adding "With Workbooks("Book1") before the code in Book2,
but that still deletes all the code in Book2. Here is the code that I
started with:


Try replacing

Set VBComps = ActiveWorkbook.VBProject.VBComponents


with

Set VBComps = Workbooks("Book2"). _
VBProject.VBComponents

or

Set VBComps = Workbooks("Book2.xls"). _
VBProject.VBComponents

if the workbook has been saved


---
Regards,
Norman