Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 310
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a standard Quick Launch menu in Excel 2007 Lasse[_2_] Excel Programming 3 October 22nd 08 03:21 PM
Absolute value with a quick formula / shortcut? Derek Excel Worksheet Functions 3 September 27th 07 09:09 PM
Shortcut Keys -- quick find scottech Excel Discussion (Misc queries) 3 November 15th 05 08:08 PM
Quick question - quick answer about assigning shortcut keys funkymonkUK[_75_] Excel Programming 1 October 13th 05 10:50 AM
Using vb to launch a shortcut JT[_2_] Excel Programming 1 April 23rd 04 08:50 PM


All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"