Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default UserForm Show Problem

Hi all, I have code (see below) in sheet module

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Not Application.Intersect(Range("D11:D12"), Target) Is Nothing Then
UserForm1.Show
End If
End Sub

when i double click on range D11 or D12 i get error message saying
" Run-time error '459':
Object or class does not support the set of events "

and when i click on debug then line "UserForm1.Show" gets higlighted.
It was working alright couple days ago but suddenly i start getting
this error. Please can any friend can help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default UserForm Show Problem

fiorst comment out Userform1.show and replace with a=1 to make sure it it the
userform that has the problem. If the error doesn't occur then there is
something wrong with the target location.

Otherwise uncomment out the userform statement and put a break point using
F9 on the first line of every function in the userform. The first line is
the line with SUB like any onclick or initialize function.

The run the code. Keep on pressing F5 until the error occurs. the last
break point you reach will tell you which function is causing the error.

the start stepping through the last routine until you find the problem

One thing that may help find the problem quickly is to change the VBA errror
trapping. Go to VBA menu tools - OPtions - General - Error trapping. Change
setting to Trap on All errors. Also in finding problems like this I comment
out all ON Error statements. You may be bypassing an error and then casuing
a 2nd statement to fail. Yo can later add back the error trapping statment
after yo get the code working.


"K" wrote:

Hi all, I have code (see below) in sheet module

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Not Application.Intersect(Range("D11:D12"), Target) Is Nothing Then
UserForm1.Show
End If
End Sub

when i double click on range D11 or D12 i get error message saying
" Run-time error '459':
Object or class does not support the set of events "

and when i click on debug then line "UserForm1.Show" gets higlighted.
It was working alright couple days ago but suddenly i start getting
this error. Please can any friend can help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default UserForm Show Problem

In the VBA editor, go to the Tools menu and choose Options. There,
select the General tab and change the Error Trapping setting to "Break
In Class Module". If the setting is not "Break In Class" and an error
occurs in the code within the UserForm, the debugger will take you to
the line of code in which the class (in this case the loaded instance
of the user form) was created. In your code, there is nothing wrong
with the UserForm1.Show code as such, but if an error occurs within
the form, that line is highlighted by the debugger. When error
trapping is "Break In Class Module" and there is an error within the
userform's code, the debugger will take you to the line of code that
actually caused the error within the form's code.

As a general rule, you should always have error trapping set to "Break
In Class Module" unless you have a very good reason not to.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sun, 23 Aug 2009 03:04:33 -0700 (PDT), K
wrote:

Hi all, I have code (see below) in sheet module

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Not Application.Intersect(Range("D11:D12"), Target) Is Nothing Then
UserForm1.Show
End If
End Sub

when i double click on range D11 or D12 i get error message saying
" Run-time error '459':
Object or class does not support the set of events "

and when i click on debug then line "UserForm1.Show" gets higlighted.
It was working alright couple days ago but suddenly i start getting
this error. Please can any friend can help.

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
Problem with hide/show for userform where showmodal is set to true Mike Clemens Excel Programming 1 December 28th 08 11:06 PM
Userform to show and update data problem Pierre[_18_] Excel Programming 1 December 8th 07 06:19 PM
Userform show / hide problem brookly Excel Programming 6 March 18th 06 09:48 PM
UserForm Show problem gabch[_6_] Excel Programming 1 March 6th 06 02:21 PM
Userform show problem... RPIJG[_59_] Excel Programming 0 June 29th 04 04:15 PM


All times are GMT +1. The time now is 05:31 PM.

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

About Us

"It's about Microsoft Excel"