View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default sht and wrkbook proc copy

YOu should be able to find something here to help you.

http://www.cpearson.com/excel/vbe.aspx

I believe if you copy the sheet, you get the code that's tied to it.
--
HTH,
Barb Reinhardt



"x " wrote:

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 ***