View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default What is the quickest way to copy codes in Sheets?



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Anson" wrote in message
...
I have wrote some codes to copy the modules and forms from the one

workbook to another. Most of them worked fine, but the sheets modules were
turned into class modules. I know I could manually enter the exact lines
from the sheets and have the macro to wirte it, but is there a way to copy?

This is the section that deals with coping modules:

'---------------------------------------------------------------------------
------
Dim NewBook As Workbook
Dim VBComponent As VBIDE.VBComponent, ModName As String

'Copy Modules
ModName = ThisWorkbook.Path & "\Merit Worksheet Code.txt"
For Each VBComponent In ThisWorkbook.VBProject.VBComponents

VBComponent.Export ModName
NewBook.VBProject.VBComponents.Import ModName
Kill ModName

Next VBComponent