Open a webpage from VBA
Solved
fourvin
Posted messages
286
Status
Member
-
fourvin Posted messages 286 Status Member -
fourvin Posted messages 286 Status Member -
Good evening,
I am using Office 2007 and I am looking for a way to open a given Internet URL from a VBA procedure.
For example, how can I use VBA to open the URL http://www.commentcamarche.net in my default browser?
Thank you in advance for the answers.
Configuration: Windows 7 / Firefox 3.6.10
I am using Office 2007 and I am looking for a way to open a given Internet URL from a VBA procedure.
For example, how can I use VBA to open the URL http://www.commentcamarche.net in my default browser?
Thank you in advance for the answers.
Configuration: Windows 7 / Firefox 3.6.10
1 answer
-
Hello,
Test carried out with FF first, then IE, and then again FF as the default browser....
In a standard module:
Option Explicit 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 Sub Open() Dim File As String File = "https://www.commentcamarche.net/" ShellExecute 0, "", File, "", "", 0 End Sub
Good night-
-
Good evening,
I was also provided with this simplified version for Access, likely degraded, but which I had no problem using:
Public Function fIE(wID As String, wCHEM As String) ' In a form control, opens the URL corresponding to the code ' wCHEM=base path of the site http://... ' WID=page identifier Dim A A = Shell("C:\Program Files\Internet Explorer\iexplore.exe "+wCHEM+wID, vbNormalFocus) End Function
-