Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
adding shortcut to Quick Launch
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
adding shortcut to Quick Launch
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 -- Gary''s Student - gsnu200817 "Michelle" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to create a standard Quick Launch menu in Excel 2007 | Excel Programming | |||
Absolute value with a quick formula / shortcut? | Excel Worksheet Functions | |||
Shortcut Keys -- quick find | Excel Discussion (Misc queries) | |||
Quick question - quick answer about assigning shortcut keys | Excel Programming | |||
Using vb to launch a shortcut | Excel Programming |