Navigating to a URL using Windows
This little piece of code will show you how to navigate to a URL using Windows' built-in systems.
Author: Jens G. BalchenTo navigate to a given URL, copy and paste this code into a form or module. The code will launch a DLL which will load the default browser in your machine (Internet Explorer, Netscape, Opera, or any other) and navigate to the URL. Public Sub NavigateURL(ByVal URL As String) Dim File As String Dim fH As Integer ' Create a URLShortcut File so that the url.dll function OpenURL will work File = App.Path & "\" & VBA.Format(Now, "HH_NN_SS") & ".URL" fH = FreeFile Open File For Output As #fH Print #fH, "[InternetShortcut]" Print #fH, "URL=" & URL Close #fH Shell "rundll32.exe url.dll,OpenURL " & File, 1 Kill File End Sub |
||
Editor: Jens G. Balchen Last update: 2024-11-21 Copyright 1995-2024 VBI |