Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Please Help - Trying to Launch IE from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Please Help - Trying to Launch IE from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Please Help - Trying to Launch IE from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Please Help - Trying to Launch IE from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Please Help - Trying to Launch IE from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Please Help - Trying to Launch IE from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Please Help - Trying to Launch IE from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Please Help - Trying to Launch IE from Excel

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
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
VB 6.0 to Launch excel Jason V[_2_] Excel Programming 7 March 20th 07 09:17 PM
Launch Excel from the Web DAN Excel Programming 2 October 23rd 06 03:29 PM
How to launch one XLA from another on Excel launch levka Excel Programming 1 July 25th 05 04:22 AM
Macro launch - Button vs Manual launch , has different results. Wayne Excel Programming 4 February 23rd 05 11:33 AM
Excel No-Launch LarryP[_2_] Excel Programming 0 June 18th 04 02:30 PM


All times are GMT +1. The time now is 09:07 AM.

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"