View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Displaying Web Page

Hi Jim,

Jim Zeeb wrote:
I want to display a web page using info from a cell when that cell is
double clicked.

For example, I have a cell with a stock symbol in it ( i.e. MSFT)
When I double-click the cell, I want to start IE with the URL:
http://finance.yahoo.com/q?s=MSFT


Something like this may work for you:

Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Dim sTicker As String
Dim objIE As Object

If Target.Cells.Count = 1 Then
sTicker = CStr(Target.Value)
If Len(sTicker) = 4 And Not IsNumeric(sTicker) Then
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Navigate "http://finance.yahoo.com/q?s=" _
& CStr(sTicker)
.Visible = True
End With
Set objIE = Nothing
End If
End If
End Sub

This code should be placed in the worksheet module (right-click sheet tab
and select View Code).

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]