Option Explicit
'References:
'Microsoft Shell Controls And Automation '(C:\Windows\System32\Shell32.dll)
'ShowCommand Constants
'1 Activates and restores it to its original size and position.
'2 Activates the window and displays it as a minimized window.
'3 Activates the window and displays it as a maximized window.
Private Const ssfSYSTEM = 37 'System32 directory
Private Const ssfPROGRAMS = 2 'Program Files
Private Const ssfDESKTOP = 0
Private Const ssfDESKTOPDIRECTORY = 16
Private Const ssfDRIVES = 17
Private Const ssfPERSONAL = 5 'My Documents folder
Private Const ssfCOMMONDESKTOPDIR = 25
Private Const ssfWINDOWS = 36 'Windows or Winnt directory
Private Sub Command1_Click()
'Original Comment: Finds and displays information and Web sites on the Internet.
'Original Argument: "" 'Uses your default home page setting. Replace arg with where you want IE to go to when opened
'Original ShowCommand: 1
'Original Icon Path: "C:\Program Files\Internet Explorer\IEXPLORE.EXE" - For my system, yours would be where ever you have IE installed to.
'Original Icon Index:
'Test Icon Path: "C:\Windows\System32\SHELL32.dll"
'Test Icon Index: 46 - Windows Update Icon
Dim oShell As Shell32.Shell
Dim oFolder As Shell32.Folder
Set oShell = New Shell32.Shell
Set oFolder = oShell.NameSpace(ssfPROGRAMS)
If (Not oFolder Is Nothing) Then
Dim oFolderItem As Shell32.FolderItem
Set oFolderItem = oFolder.ParseName("Internet Explorer.lnk")
If (Not oFolderItem Is Nothing) Then
Dim oShellLink As ShellLinkObject
Set oShellLink = oFolderItem.GetLink
If (Not oShellLink Is Nothing) Then
'Set the arguments for the ShellLinkObject
oShellLink.Arguments = "http://www.vbforums.com"
oShellLink.Description = "This text is added to the comments of the link programmatically."
oShellLink.ShowCommand = 3
oShellLink.SetIconLocation "C:\Windows\System32\SHELL32.dll", 46 'Windows Update Icon
oShellLink.Save
'oFolderItem.InvokeVerb "open" 'Opens IE and navigates to VBF !
End If
Set oShellLink = Nothing
End If
Set oFolderItem = Nothing
End If
Set oFolder = Nothing
Set oShell = Nothing
End Sub