Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
David wrote
Simple solution. Many thanks. I may use it in the future. Actually, a lightbulb lit when I realized that since I used the line: ActiveWorkbook.Sheets.Copy instead of ActiveWorkbook.Copy none of the modules or forms were copied to the new book anyway, so I didn't need to delete anything since I had no sheet level code. So I looked at Chip Pearson's .vbe page and used his method of copying a module after putting the desired routines in the separate Module2: With ThisWorkbook FName = .Path & "\code.txt" .VBProject.VBComponents("Module2").Export FName End With ActiveWorkbook.VBProject.VBComponents.Import FName Kill FName I shouldn't have said "instead of ActiveWorkbook.Copy", since you can't do that anyway. What I should have said is: Since there is no sheetlevel code and ActiveWorkbook.Sheets.Copy doesn't copy any modules/forms, there is nothing to delete anyway, so I could do away with all that VBComp stuff and replace it with the Module copy code. -- David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Sheet #'s, but leave cell reference | Excel Discussion (Misc queries) | |||
Macros: can you copy macros from one doc to another? | Excel Discussion (Misc queries) | |||
using IF function to copy, but leave populated cell alone | Excel Worksheet Functions | |||
How to copy paste from Excel and leave the pasted data editable? | Excel Worksheet Functions | |||
weird saving of a document with macros resulting with macros being transfered to the copy | Excel Programming |