Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default CAN ANYONE SOVLE THIS PROBLEM!!!

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default CAN ANYONE SOVLE THIS PROBLEM!!!

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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default CAN ANYONE SOVLE THIS PROBLEM!!!

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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default CAN ANYONE SOVLE THIS PROBLEM!!!

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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CAN ANYONE SOVLE THIS PROBLEM!!!

I think she mean's

Application.EnableEvents = False

--
Regards,
Tom Ogilvy


"Jim Warren" wrote in message
...
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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default CAN ANYONE SOVLE THIS PROBLEM!!!

Thanks Tom. I tried that and it didn't make any difference. Do you have any
ideas?

Jim

"Tom Ogilvy" wrote:

I think she mean's

Application.EnableEvents = False

--
Regards,
Tom Ogilvy


"Jim Warren" wrote in message
...
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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CAN ANYONE SOVLE THIS PROBLEM!!!

If I did, I wouldn't make you beg for them, I would have posted them.
Sorry.

--
Regards,
Tom Ogilvy

"Jim Warren" wrote in message
...
Thanks Tom. I tried that and it didn't make any difference. Do you have

any
ideas?

Jim

"Tom Ogilvy" wrote:

I think she mean's

Application.EnableEvents = False

--
Regards,
Tom Ogilvy


"Jim Warren" wrote in message
...
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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CAN ANYONE SOVLE THIS PROBLEM!!!

If you just want a work around and then get on with it.
I think if you use the normal way to create a sub in a module and not use
CreateEventProc you might be more successful. I rarely played with
CreateEventProc, but I don't recall every being successful with it (mostly
in xl97).

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

if you want to see sample code on just writing code in a module (although
Chip has examples of CreateEventProc there also as I recall).

--
Regards,
Tom Ogilvy


"Jim Warren" wrote in message
...
Thanks Tom. I tried that and it didn't make any difference. Do you have

any
ideas?

Jim

"Tom Ogilvy" wrote:

I think she mean's

Application.EnableEvents = False

--
Regards,
Tom Ogilvy


"Jim Warren" wrote in message
...
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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"







  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default CAN ANYONE SOVLE THIS PROBLEM!!!

Obviously, you know your app better than I do but in the 20+ years I've
been developing systems I have never come across a case where I had to
code a program to add code to another file -- well, other than when
writing a compiler or a system generator {g}.

IMO, propagating code through workbooks is a sure-fire way to create a
maintenance, security, and integrity nightmare. Doing so through code
simply compounds the problem.

If you want to handle worksheet events, use an application level event
handler within your own program. See the XL VBA help topic 'Using
Events with the Application Object' for more.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Thanks Tom. I tried that and it didn't make any difference. Do you have any
ideas?

Jim

"Tom Ogilvy" wrote:

I think she mean's

Application.EnableEvents = False

--
Regards,
Tom Ogilvy


"Jim Warren" wrote in message
...
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"
wrote:

HERE'S THE CODE:
Dim NDXcode As String, StartLine As Long
NDXcode = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(NDXcode).Cod eModule
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"






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"