View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
x [email protected] x tomi3440@yahoo.com is offline
external usenet poster
 
Posts: 8
Default sht and wrkbook proc copy

Dim comS As VBIDE.VBComponent, comD As VBIDE.VBComponent, wbS, wbD, codM
As CodeModule, srshtS, srshtD
Dim comsS As VBIDE.VBComponents, comsD As VBIDE.VBComponents
Set comsS = ThisWorkbook.VBProject.VBComponents
Set comsD = Workbooks("ha.xls").VBProject.VBComponents

For Each comS In comsS
If comS.Type = vbext_ct_Document Then
Set codM = comS.CodeModule
srcodS = codM.Lines(1, codM.CountOfLines)
For Each comD In comsD
If comD.Type = vbext_ct_Document Then
srshtS = comS.Properties("name")
srshtD = comD.Properties("name")
If srshtS = srshtD Or codM = "ThisWorkbook" Then
comD.CodeModule.AddFromString srcodS 'error line
Exit For 'error line
End If
End If
Next
End If
Next

I want to copy sheets and thisworkbook procedures between
projects.......
but,,, error ..... ooooooooooh
error occur, and the excel application is killed







*** Sent via Developersdex http://www.developersdex.com ***