I am trying to copy code in ThisWorkbook from a source WB to
Destination WB.
Prior to this point, I delete all existing code in Destination WB 'thisworkbook'.
I do reference VB extensibility.
'This is code in a driver utility (which is not the source or destination WB)
----------------------------
Dim theCode As String
' get the lines of code to insert
theCode = GetWorkbookOpenCode
With Destination.VBProject.VBComponents("ThisWorkbook".CodeModule
NextLine = .CountOfLines + 1
.InsertLines NextLine, theCode
End With
---------------------------
Problem is, any way I have tried it, Excel 97 crashes with an access violation on
.InsertLines NextLine, theCode
Any help would be greatly appreciated.
Destination WB.
Prior to this point, I delete all existing code in Destination WB 'thisworkbook'.
I do reference VB extensibility.
'This is code in a driver utility (which is not the source or destination WB)
----------------------------
Dim theCode As String
' get the lines of code to insert
theCode = GetWorkbookOpenCode
With Destination.VBProject.VBComponents("ThisWorkbook".CodeModule
NextLine = .CountOfLines + 1
.InsertLines NextLine, theCode
End With
---------------------------
Problem is, any way I have tried it, Excel 97 crashes with an access violation on
.InsertLines NextLine, theCode
Any help would be greatly appreciated.