LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default BeforeDoubleClick doesn't seem to work

Nick, Jay, thank you both. I have it working now. I appreciate your patient
explanations. I am only a novice VB programmer, using it for little apps to
help with work.
I have a new challenge... I'll be posting it. Been working on it all day and
can't make it work.

Dan

"Jay" wrote:

Hi Dan -

It sounds like you are on the right track, but in the wrong place. Based on
what you are seeing in the comboboxes (General and your procedure names), you
are in a General module. As Nick instructed earlier, you need to develop
your BeforeDoubleClick event procedure on a Worksheet module instead.

1. To get there, open the VB Editor and look in the Project Explorer (in the
left-hand pane).

2. Find your project, open the folder named "Microsoft Excel Objects", and
double-click on the worksheet where your BeforeDoubleClick procedure will
apply. This opens a worksheet module where you can build your
BeforeDoubleClick event procedure.

3. Change the left-hand combobox at the top of the main editor window to
"Worksheet". Then, the right-hand combobox will show a list of events.
Choose BeforeDoubleClick and the editor will produce a procedure a valid code
template for you to enhance as Nick has described.

4. See my response to your next post for a sample of code. Make sure you
copy it to the Worksheet module.

--
Jay



"Dan" wrote:

Thanks Nick -
My top left combo box doesn't contain anything other than "(General)", and
the right one has all of my subs listed, but nothing else.
How do I get these combo boxes to give me other options?
Thanks!

"NickHK" wrote:

Dan,
You cannot make up events and expect Excel to fire them. It is best to let
Excel create the routine stubs for you to ensure they are correct.
On the worksheet module, select Worksheet from the top-left combo box then
select the required event from the top-right combo box.
See the difference:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
MsgBox "Range= " & Target
End Sub

Also, I avoid using default properties. Be explicit.
It looks like you want
Target.Address
but you are getting
Target.Value

NickHK

"Dan" wrote in message
...
I have this code in my project, and double clicking on the sheet doesn't
appear to do anything:

Public Sub BeforeDoubleClick(ByVal SelRange As Range, Cancel As Boolean)
Cancel = True
msgbox "Range= " & SelRange
End Sub

What am I doing wrong?

Thanks -
Dan



 
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
BeforeDoubleClick processing question(s) Forms / Send to .....VBA or Macro? Excel Programming 2 November 8th 06 04:06 AM
BeforeDoubleClick Cancel=True not working Reggie Excel Programming 1 September 20th 05 03:43 AM
beforeDoubleClick (target, true) mark kubicki Excel Programming 2 May 10th 04 10:33 PM
Selective protection of charts - permit only beforedoubleclick? Jon Peltier[_5_] Excel Programming 0 January 23rd 04 11:41 PM
Selective protection of charts: permit only BeforeDoubleClick ? David Powell Excel Programming 0 July 14th 03 01:14 AM


All times are GMT +1. The time now is 11:26 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"