Create Internet Shortcut On Desktop

'Insert the following code to your form:

Private Sub Form_Load()
Dim URLFile As String
Dim URLTarget As String
Dim MyFileNum As Integer
'Replace Yahoo with your desirable shortcut's name
URLFile = "C:\Windows\Desktop\Yahoo.url"
'Replace http://www.yahoo.com with the address you want to link to
URLTarget = "http://www.yahoo.com"
MyFileNum = FreeFile
Open URLFile For Output As MyFileNum
Print #MyFileNum, "[InternetShortcut]"
Print #MyFileNum, "URL=" & URLTarget
Close MyFileNum
End Sub

Go Back