|
-
Apr 25th, 2006, 10:40 AM
#1
Thread Starter
Member
[RESOLVED] opening files via commandbutton
I'm trying to find the code to have a web page open from a command button.
specifically, when I simply press a button on one of my sheets, I want IE to launch and a specific web page to load. (this site is one of them actually).
I can get excel sheet to load this way but I havent been able to get web pages to load yet. any help would be appreciated.
Last edited by Albatross; Apr 25th, 2006 at 11:05 AM.
-
Apr 25th, 2006, 10:45 AM
#2
Re: opening files via commandbutton
Try the following
VB Code:
Private 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
Private Sub Command1_Click()
Dim r As Long
r = ShellExecute(0, "open", "WWW.YourWebAddressHere.COM", 0, 0, 1)
End Sub
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Apr 25th, 2006, 10:58 AM
#3
Thread Starter
Member
Re: opening files via commandbutton
My mistake. I specified a commandbutton but neglected to specifcy that I'm using excel.
I tried adding in the code supplied but getting compile errors.
-
Apr 25th, 2006, 11:01 AM
#4
Re: opening files via commandbutton
Have you added the Private Declare Function statement at the top of the module? it need to be before any procedure?
I ran this in excel and it worked fine.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Apr 25th, 2006, 11:04 AM
#5
Thread Starter
Member
Re: opening files via commandbutton
That worked this time. thank you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|