Thread: Event macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
David McRitchie[_2_] David McRitchie[_2_] is offline
external usenet poster
 
Posts: 134
Default Event macro

Hi Dave,
Thanks that works, and completely solves the problem.
I'll have to think of Cancel = True in terms of being
done with editing a cell rather than just something thrown in to turn
off the normal right-click (context) menu when doing my own
right-click Event macros.. .

I placed it just before my invocation of Internet Explorer , which
is after the last use of the activecell.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean) Dim filename As String, IEpath As String
Dim filename As String, IEpath As String
IEpath = "C:\program files\internet explorer\iexplore.exe"
If ActiveCell.Column = 1 Then
If Right(LCase(ActiveCell.Value), 4) = ".htm" Then
filename = "c:\website\dmcritchie\excel\" _
& Trim(ActiveCell.Value)
Cancel = True '--no need or further need to edit cell
Shell IEpath & " " & filename, vbNormalFocus
End If
ElseIf ...[clipped]

Full coverage on my "Fix 404, Page Not Found, Link Errors"
http://www.mvps.org/dmcritchie/excel/fix404.htm

I'll have to write a note to myself about subject title not being very
descriptive.
---
HTH, (full coverage on my fix404.htm page)
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Dave Peterson" wrote ..
Try adding

Cancel = true

At the end of your macro. This says not to stay in the cell to try to edit it.
(won't hurt if you have edit directly in cells on or off.)


David McRitchie wrote:
One annoyance I have with Event macros is that I have to select
another cell afterwards so that I can work in the VBE to make
changes to the macro. Even if I exit out of IE after invoking
the following Event macro, I still have to select a cell so that
I can edit the macro. Is there a way around this?