Try something like the following. You'll need a reference to the
Extensibility library.
Sub CopySheetModule()
Dim ThisVBP As VBIDE.VBProject
Dim ThatVBP As VBIDE.VBProject
Dim ThisVBComp As VBIDE.VBComponent
Dim ThatVBComp As VBIDE.VBComponent
Dim S As String
Set ThisVBP = ThisWorkbook.VBProject
Set ThatVBP = Workbooks("Book2").VBProject '<<< CHANGE
Set ThisVBComp = ThisVBP.VBComponents("Sheet1") '<<< CHANGE
Set ThatVBComp = ThatVBP.VBComponents("Sheet1") '<<< CHANGE
With ThisVBComp.CodeModule
S = .Lines(1, .CountOfLines)
End With
With ThatVBComp.CodeModule
.DeleteLines 1, .CountOfLines
.AddFromString S
End With
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
"Otto Moehrbach" wrote in message
...
Excel XP and Win XP
I have used code furnished by Chip Pearson to copy a module from one
file to another. I believe, maybe I'm wrong, that this code deals with
regular modules only. My question now is: Can this be done with a sheet
or workbook module? And how? Thanks for your time. Otto