Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to launch IE from a VBA macro in Excel. After a great deal of
web searching I came up with the following ... Public Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long <some other stuff Sub test23() Dim WEB_SITE_URL As String WEB_WITE_URL = "http://www.mysite.com" Dim SW_SHOWNORMAL As Integer SW_SHOWNORMAL = 1 'Launch Web Site ShellExecute 0, vbNullString, WEB_SITE_URL, vbNullString, _ vbNullString, SW_SHOWNORMAL End Sub When I execute test23 I get a windows explorer window opening up to the My Documents directory. No error messages. I think that I am close. Could someone please help me get this to launch IE. Thanks, Bob |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could just insert a hyperlink.
"eBob.com" wrote: I am trying to launch IE from a VBA macro in Excel. After a great deal of web searching I came up with the following ... Public Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long <some other stuff Sub test23() Dim WEB_SITE_URL As String WEB_WITE_URL = "http://www.mysite.com" Dim SW_SHOWNORMAL As Integer SW_SHOWNORMAL = 1 'Launch Web Site ShellExecute 0, vbNullString, WEB_SITE_URL, vbNullString, _ vbNullString, SW_SHOWNORMAL End Sub When I execute test23 I get a windows explorer window opening up to the My Documents directory. No error messages. I think that I am close. Could someone please help me get this to launch IE. Thanks, Bob |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, and that has an advantage if I ever want to export the spreadsheet to
an html file. But it also makes the spreadsheet unnecessarily large. So I prefer the macro solution. Bob "Merle" wrote in message ... You could just insert a hyperlink. "eBob.com" wrote: I am trying to launch IE from a VBA macro in Excel. After a great deal of web searching I came up with the following ... Public Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long <some other stuff Sub test23() Dim WEB_SITE_URL As String WEB_WITE_URL = "http://www.mysite.com" Dim SW_SHOWNORMAL As Integer SW_SHOWNORMAL = 1 'Launch Web Site ShellExecute 0, vbNullString, WEB_SITE_URL, vbNullString, _ vbNullString, SW_SHOWNORMAL End Sub When I execute test23 I get a windows explorer window opening up to the My Documents directory. No error messages. I think that I am close. Could someone please help me get this to launch IE. Thanks, Bob |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about this?
Option Explicit Sub GoToWebSite() Dim appIE As InternetExplorer Dim sURL As String Application.ScreenUpdating = False Set appIE = New InternetExplorer sURL = "http://www.mywebsite.com" With appIE .Navigate sURL .Visible = True End With Application.ScreenUpdating = True Set appIE = Nothing End Sub Of course you would need to set a reference to Microsoft Internet Controls (shdocvw.dll). For more samples check out http://www.codeforexcelandoutlook.co...texplorer.html HTH, JP On Feb 26, 11:09*am, "eBob.com" wrote: Yes, and that has an advantage if I ever want to export the spreadsheet to an html file. *But it also makes the spreadsheet unnecessarily large. *So I prefer the macro solution. Bob "Merle" wrote in message ... You could just insert a hyperlink. "eBob.com" wrote: I am trying to launch IE from a VBA macro in Excel. *After a great deal of web searching I came up with the following ... Public Declare Function ShellExecute Lib "shell32.dll" _ * * Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ * * ByVal lpFile As String, ByVal lpParameters As String, _ * * ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long <some other stuff Sub test23() * * * * *Dim WEB_SITE_URL As String * * * * *WEB_WITE_URL = "http://www.mysite.com" Dim SW_SHOWNORMAL As Integer SW_SHOWNORMAL = 1 * * 'Launch Web Site * * ShellExecute 0, vbNullString, WEB_SITE_URL, vbNullString, _ * * * * * * * * *vbNullString, SW_SHOWNORMAL End Sub When I execute test23 I get a windows explorer window opening up to the My Documents directory. *No error messages. I think that I am close. Could someone please help me get this to launch IE. Thanks, *Bob- Hide quoted text - - Show quoted text - |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi "Bob",
in the word groups I answered that question, like that: Sub Test2() ' Dim var Dim s As String s = "C:\Program Files\Internet Explorer\iexplore.exe" s = Chr(34) & s & Chr(34) s = s & "http://www.google.com" Shell s ' or ' var = Shell(s) End Sub Yet Karl E. Peterson, who is quite an authority, told me: "No, don't use that! It's highly fragile, and of course won't be at all to the user's pleasure if they use Firefox or Opera or something else as the default browser. Here's the simple way to load a page in whatever browser the user prefers: http://vb.mvps.org/samples/HyperJmp" Make the best of all of it. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi eBob,
Heres some pretty simple code l have been using for along time, and gives you control over the size of the IE window etc.(they are of course optional) Hope it helps Sub MyIE() Set IE = CreateObject("InternetExplorer.Application") IE.AddressBar = False IE.MenuBar = False IE.Toolbar = False IE.Width = 600 IE.Height = 750 IE.Left = 0 IE.Top = 0 IE.navigate "www.yahoo.com" IE.resizable = True IE.Visible = True End Sub Regards Michael |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
activeworkbook.followhyperlink "http://www.google.com"
Tim "eBob.com" wrote in message ... I am trying to launch IE from a VBA macro in Excel. After a great deal of web searching I came up with the following ... Public Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long <some other stuff Sub test23() Dim WEB_SITE_URL As String WEB_WITE_URL = "http://www.mysite.com" Dim SW_SHOWNORMAL As Integer SW_SHOWNORMAL = 1 'Launch Web Site ShellExecute 0, vbNullString, WEB_SITE_URL, vbNullString, _ vbNullString, SW_SHOWNORMAL End Sub When I execute test23 I get a windows explorer window opening up to the My Documents directory. No error messages. I think that I am close. Could someone please help me get this to launch IE. Thanks, Bob |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the many responses. They were all helpful. This response from
Tim seems like the perfect solution to my problem. Thanks again to Tim and everyone else who responded. Bob "Tim Williams" <timjwilliams at gmail dot com wrote in message ... activeworkbook.followhyperlink "http://www.google.com" Tim "eBob.com" wrote in message ... I am trying to launch IE from a VBA macro in Excel. After a great deal of web searching I came up with the following ... Public Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long <some other stuff Sub test23() Dim WEB_SITE_URL As String WEB_WITE_URL = "http://www.mysite.com" Dim SW_SHOWNORMAL As Integer SW_SHOWNORMAL = 1 'Launch Web Site ShellExecute 0, vbNullString, WEB_SITE_URL, vbNullString, _ vbNullString, SW_SHOWNORMAL End Sub When I execute test23 I get a windows explorer window opening up to the My Documents directory. No error messages. I think that I am close. Could someone please help me get this to launch IE. Thanks, Bob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB 6.0 to Launch excel | Excel Programming | |||
Launch Excel from the Web | Excel Programming | |||
How to launch one XLA from another on Excel launch | Excel Programming | |||
Macro launch - Button vs Manual launch , has different results. | Excel Programming | |||
Excel No-Launch | Excel Programming |