adding shortcut to Quick Launch

M

Michelle

Hi!
Now that I can delete and recreate a shortcut on the users desktop, can I
also delete and create one on their Quick Launch toolbar as well? They have
the correct shortcut on their desktop but when they initiate the Quick Launch
shortcut they have the wrong shortcut! Thank you so much for your help!
By the way I often have trouble posting a question or reply on your form. I
comes up blank and I can't post.

Function DeleteAndRecreateShortcut()

Dim WSHShell As Object
Dim MyShortCut As Object
Dim DesktopPath As String
Dim myFileName As String
Dim TestStr As String

Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
myFileName = DesktopPath & "\" & "Markup Spreadsheet" & ".lnk"

'Check to see if shortcut exists. If true, delete it.

TestStr = ""
On Error Resume Next
TestStr = Dir(myFileName)
On Error GoTo 0

If TestStr = "" Then
'doesn't exist
Else
'won't hurt if it's not read only, either.
SetAttr pathname:=myFileName, Attributes:=vbNormal
Kill pathname:=myFileName
End If

'Create new shortcut for users desktop

Set MyShortCut = WSHShell.CreateShortcut(myFileName)
With MyShortCut
.TargetPath = _
"\\Bwes.net\Barberton file
shares\DocControlPLM\BatchLoadFiles\ScriptsAndZips\Shortcuts\Markup
Spreadsheet.lnk"
.Description = "Markup Spreadsheet"
.Save
End With


Set WSHShell = Nothing
MsgBox "The MARKUP SPREADSHEET shortcut has been placed on your desktop"
& vbCrLf & _
"The shortcut has the same properties as the old shortcut:" &
vbCrLf & _
" - the shortcut is identified by a Gold Star" & vbCrLf & _
" - the shortcut title reads 'Markup Spreadsheet'" & vbCrLf &
vbCrLf & _
" On OK, this worksheet will close" & vbCrLf & _
" Then relaunch the MARKUP spreadsheet from the Desktop shortcut"
Workbooks("Document Control Markup.xls").Close SaveChanges:=False

End Function
 
G

Gary''s Student

Once you have the DesktopPath, you can get the path to the QuickLaunch Folder
with simple string manipulation:

Sub liminal()
Dim WSHShell As Object
Dim MyShortCut As Object
Dim DesktopPath As String
Dim myFileName As String, s2 As String
Dim TestStr As String, s1 As String
Dim QuickPath As String

Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
MsgBox (DesktopPath)

s1 = "Desktop"
s2 = "Application Data\Microsoft\Internet Explorer\Quick Launch"
QuickPath = Replace(DesktopPath, s1, s2)
MsgBox (QuickPath)
End Sub
 
M

Michelle

Thank You Gary''s Student! You are a gentleman(woman) AND a scholar!
That was most helpful.
 

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

Top