P
perf
Hi,
I'm having a quite strange problem in a VBA macro that I made that is
driving me crazy. First of all, I am using Excel 2003.
Well, when I try to insert lines of code in vba worksheet "sheet1", I always
get an Automation Error that causes the restart of excel.
The precise error is:
"Automation Error. connection to type library or object library for remote
process has been lost. Press OK for dialog ot remove reference."
The error always happens at the SECOND insertline instruction (the first
line in sheet1 is written correctly) in the following code:
----...----
Set VBCodeModmej =
ActiveWorkbook.VBProject.VBComponents(ActiveWorkbook.Worksheets("Sheet1").CodeName).CodeModule
VBCodeModmej.InsertLines 1, "Private Sub Worksheet_SelectionChange(ByVal
Target As Range) "
VBCodeModmej.InsertLines 2, "Dim Touched As Range"
VBCodeModmej.InsertLines 3, "Dim void As String"
etc etc
---...---
Note that with Office 2007 this never happens ...!
I tried the following things, read here and there for the network (I tried
them one at a time ...):
-Put option explicit: useless
-Put on error resume next: useless
-Put Instead of 'private sub' the string 'sub': useless
-Put Application.EnableEvents = True: useless
-Put Application.OnTime Now + TimeValue("00:00:10") before the Set line:
useless
Can you help me somehow?
Thank you so much right now
Mark
I'm having a quite strange problem in a VBA macro that I made that is
driving me crazy. First of all, I am using Excel 2003.
Well, when I try to insert lines of code in vba worksheet "sheet1", I always
get an Automation Error that causes the restart of excel.
The precise error is:
"Automation Error. connection to type library or object library for remote
process has been lost. Press OK for dialog ot remove reference."
The error always happens at the SECOND insertline instruction (the first
line in sheet1 is written correctly) in the following code:
----...----
Set VBCodeModmej =
ActiveWorkbook.VBProject.VBComponents(ActiveWorkbook.Worksheets("Sheet1").CodeName).CodeModule
VBCodeModmej.InsertLines 1, "Private Sub Worksheet_SelectionChange(ByVal
Target As Range) "
VBCodeModmej.InsertLines 2, "Dim Touched As Range"
VBCodeModmej.InsertLines 3, "Dim void As String"
etc etc
---...---
Note that with Office 2007 this never happens ...!
I tried the following things, read here and there for the network (I tried
them one at a time ...):
-Put option explicit: useless
-Put on error resume next: useless
-Put Instead of 'private sub' the string 'sub': useless
-Put Application.EnableEvents = True: useless
-Put Application.OnTime Now + TimeValue("00:00:10") before the Set line:
useless
Can you help me somehow?
Thank you so much right now
Mark