Create Shortcut

J

Jose Perdigao

I have the following cod to create shortcuts (This code I copied from this
newsgroup).



Public Sub CreateDesktopShortcut(strShortcutTitle As String, Optional
strTargetPath As String = "")

On Error Resume Next



Dim oShell As IWshShell_Class

Dim oShortcut As IWshShortcut_Class

Dim vItem As Variant

Dim vType As Variant



Set oShell = New IWshShell_Class



If strTargetPath = "" Then

strTargetPath = CurrentDb.Name

End If



For Each vItem In oShell.SpecialFolders



If Mid(vItem, Len(vItem) - 6, 7) = "Desktop" And InStr(1, vItem, "All
Users") = 0 And InStr(1, UCase(vItem), "ADMINISTRATOR") = 0 Then

oShortcut.Delete 'Delete existing shortcut

Set oShortcut = oShell.CreateShortcut(vItem & "\" & strShortcutTitle
& ".lnk")

oShortcut.IconLocation = PathFE() & "Icons\WorkOrder.ico, 0"

oShortcut.TargetPath = strTargetPath

oShortcut.Save



End If



Next



End Sub



This function works fine to create shortcut I we want using only the path of
the application, example ("C:\Program Files\Microsoft
Office\Office11\Samples\Northwind.mdb")



However, I have the following questions:



1. I would like add the command line with the path of MASccess, example:



"C:\Program Files\Microsoft Office\Office11\MSAccess.exe" "C:\Program
Files\Microsoft Office\Office11\Samples\Northwind.mdb"



I tried to add the path of MASaccess but I couldn't. The marks ("") doesn't
show in the target of the icon.



2. How can I get the path of MSAccess automatically?



Any suggestions?



Thanks a lot

José Perdigao
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Create Shortcut 3
Create Desktop Shortcut 5

Top