Fandom

Visual Basic Wiki

CreateShortcut

70pages on
this wiki
Add New Page
Talk0 Share

Description Edit

Creates a shortcut that does not require any other files. (Make sure it's a ".url" extension)

Code Edit

Sub CreateShortcut(ByVal Target As String, ByVal FileName As String, _
Optional ByVal IconFile As String = ":TARGET:", Optional ByVal IconIndex As Long = 0)
    Dim FB As Integer, FileData As String
    If IconFile = ":TARGET:" Then IconFile = Target
    FileData = "[InternetShortcut]" & vbCrLf & "URL=" & Target & vbCrLf & "IconIndex=" & _
 IconIndex & vbCrLf & "IconFile=" & IconFile
    FB = FreeFile
    Open FileName For Output As #FB
        Print #FB, FileData
    Close #FB
End Sub

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.