#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Event macro

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?

You can test the following by double-clicking on either
of the following cells, and then trying to edit the event macro.

A2: userid.htm
A3: strings.htm

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim filename As String, IEpath As String
Dim RetVal As Long
IEpath = "C:\program files\internet explorer\iexplore.exe"
If ActiveCell.Column = 1 Then
If Right(LCase(ActiveCell.Value), 4) = ".htm" Then
filename = "http://www.mvps.org/dmcritchie/excel/" _
& Trim(ActiveCell.Value)
Shell IEpath & " " & filename, vbNormalFocus
End If
End If
End Sub

---
HTH,
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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Event macro

David

You could uncheck Tools - Options - Edit Directly in Cells. I would think
that you could do that programmatically, but it doesn't appear to work. The
event says BEFORE double click, but I don't think that's entirely accurate.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"David McRitchie" wrote in message
...
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?

You can test the following by double-clicking on either
of the following cells, and then trying to edit the event macro.

A2: userid.htm
A3: strings.htm

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As

Boolean)
Dim filename As String, IEpath As String
Dim RetVal As Long
IEpath = "C:\program files\internet explorer\iexplore.exe"
If ActiveCell.Column = 1 Then
If Right(LCase(ActiveCell.Value), 4) = ".htm" Then
filename = "http://www.mvps.org/dmcritchie/excel/" _
& Trim(ActiveCell.Value)
Shell IEpath & " " & filename, vbNormalFocus
End If
End If
End Sub

---
HTH,
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





  #3   Report Post  
Posted to microsoft.public.excel.programming
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?




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
Event Macro help Scott Excel Discussion (Misc queries) 3 March 22nd 10 07:19 PM
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
It seems to me that I need an event Macro, nick s Excel Worksheet Functions 8 November 28th 05 05:37 PM
'Event' macro George Gee New Users to Excel 18 August 27th 05 12:50 PM
Event Macro stevepain Excel Discussion (Misc queries) 6 August 5th 05 05:11 AM


All times are GMT +1. The time now is 10:23 AM.

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"