From: Jim Warren on
HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).CodeModule
StartLine = .CreateEventProc("SelectionChange", "Worksheet")
.InsertLines StartLine, _
<TEXT IS INSERTED HERE>
HERE'S THE ERROR:
" the object invoked has disconnected from its client" and Excel crashes
THE ERROR OCCURS AT .InsertLine StartLine,...BUT IT ALSO HAPPENS IF I SINGLE
STEP TO THE PREVIOUS LINE AND TYPE IN THE IMMEDIATE WINDOW "Print StartLine"
From: Myrna Larson on
What happens if you turn off Event trapping before you try to insert the
procedure?


On Thu, 17 Mar 2005 10:31:04 -0800, "Jim Warren"
<JimWarren(a)discussions.microsoft.com> wrote:

>HERE'S THE CODE:
>Dim NDXcode As String, StartLine As Long
>NDXcode = ActiveSheet.CodeName
>With ActiveWorkbook.VBProject.VBComponents(NDXcode).CodeModule
> StartLine = .CreateEventProc("SelectionChange", "Worksheet")
> .InsertLines StartLine, _
> <TEXT IS INSERTED HERE>
>HERE'S THE ERROR:
>" the object invoked has disconnected from its client" and Excel crashes
>THE ERROR OCCURS AT .InsertLine StartLine,...BUT IT ALSO HAPPENS IF I SINGLE
>STEP TO THE PREVIOUS LINE AND TYPE IN THE IMMEDIATE WINDOW "Print StartLine"

From: Jim Warren on
I haven't tried that. But I will and let you know.

"Myrna Larson" wrote:

> What happens if you turn off Event trapping before you try to insert the
> procedure?
>
>
> On Thu, 17 Mar 2005 10:31:04 -0800, "Jim Warren"
> <JimWarren(a)discussions.microsoft.com> wrote:
>
> >HERE'S THE CODE:
> >Dim NDXcode As String, StartLine As Long
> >NDXcode = ActiveSheet.CodeName
> >With ActiveWorkbook.VBProject.VBComponents(NDXcode).CodeModule
> > StartLine = .CreateEventProc("SelectionChange", "Worksheet")
> > .InsertLines StartLine, _
> > <TEXT IS INSERTED HERE>
> >HERE'S THE ERROR:
> >" the object invoked has disconnected from its client" and Excel crashes
> >THE ERROR OCCURS AT .InsertLine StartLine,...BUT IT ALSO HAPPENS IF I SINGLE
> >STEP TO THE PREVIOUS LINE AND TYPE IN THE IMMEDIATE WINDOW "Print StartLine"
>
>
From: Jim Warren on
How do you turn off Event trapping?


"Jim Warren" wrote:

> I haven't tried that. But I will and let you know.
>
> "Myrna Larson" wrote:
>
> > What happens if you turn off Event trapping before you try to insert the
> > procedure?
> >
> >
> > On Thu, 17 Mar 2005 10:31:04 -0800, "Jim Warren"
> > <JimWarren(a)discussions.microsoft.com> wrote:
> >
> > >HERE'S THE CODE:
> > >Dim NDXcode As String, StartLine As Long
> > >NDXcode = ActiveSheet.CodeName
> > >With ActiveWorkbook.VBProject.VBComponents(NDXcode).CodeModule
> > > StartLine = .CreateEventProc("SelectionChange", "Worksheet")
> > > .InsertLines StartLine, _
> > > <TEXT IS INSERTED HERE>
> > >HERE'S THE ERROR:
> > >" the object invoked has disconnected from its client" and Excel crashes
> > >THE ERROR OCCURS AT .InsertLine StartLine,...BUT IT ALSO HAPPENS IF I SINGLE
> > >STEP TO THE PREVIOUS LINE AND TYPE IN THE IMMEDIATE WINDOW "Print StartLine"
> >
> >
From: Tom Ogilvy on
I think she mean's

Application.EnableEvents = False

--
Regards,
Tom Ogilvy


"Jim Warren" <JimWarren(a)discussions.microsoft.com> wrote in message
news:980CB7B2-9D31-49C5-94EF-F7CA1E042EAA(a)microsoft.com...
> How do you turn off Event trapping?
>
>
> "Jim Warren" wrote:
>
> > I haven't tried that. But I will and let you know.
> >
> > "Myrna Larson" wrote:
> >
> > > What happens if you turn off Event trapping before you try to insert
the
> > > procedure?
> > >
> > >
> > > On Thu, 17 Mar 2005 10:31:04 -0800, "Jim Warren"
> > > <JimWarren(a)discussions.microsoft.com> wrote:
> > >
> > > >HERE'S THE CODE:
> > > >Dim NDXcode As String, StartLine As Long
> > > >NDXcode = ActiveSheet.CodeName
> > > >With ActiveWorkbook.VBProject.VBComponents(NDXcode).CodeModule
> > > > StartLine = .CreateEventProc("SelectionChange", "Worksheet")
> > > > .InsertLines StartLine, _
> > > > <TEXT IS INSERTED HERE>
> > > >HERE'S THE ERROR:
> > > >" the object invoked has disconnected from its client" and Excel
crashes
> > > >THE ERROR OCCURS AT .InsertLine StartLine,...BUT IT ALSO HAPPENS IF I
SINGLE
> > > >STEP TO THE PREVIOUS LINE AND TYPE IN THE IMMEDIATE WINDOW "Print
StartLine"
> > >
> > >