ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with error code (https://www.excelbanter.com/excel-programming/341327-help-error-code.html)

Tempy

Help with error code
 
Good day all, i am creating a shortcut with the code below and now need
to check if this has been created previously or not and if it has branch
to other code. Could somebody please help me out of my misery as i am
not sure how to do it.

ChDrive "C:"
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String
Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")
Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
ActiveWorkbook.Name & ".lnk")
With oShortcut
.TargetPath = ActiveWorkbook.fullName
.IconLocation = "\\nv09002\tpdrive\TM-Recon\macro\scale.ico"
.Save
End With
Set oWSH = Nothing




Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Dave Peterson

Help with error code
 
See your other thread.

Tempy wrote:

Good day all, i am creating a shortcut with the code below and now need
to check if this has been created previously or not and if it has branch
to other code. Could somebody please help me out of my misery as i am
not sure how to do it.

ChDrive "C:"
Dim oWSH As Object
Dim oShortcut As Object
Dim sPathDeskTop As String
Set oWSH = CreateObject("WScript.Shell")
sPathDeskTop = oWSH.SpecialFolders("Desktop")
Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
ActiveWorkbook.Name & ".lnk")
With oShortcut
.TargetPath = ActiveWorkbook.fullName
.IconLocation = "\\nv09002\tpdrive\TM-Recon\macro\scale.ico"
.Save
End With
Set oWSH = Nothing

Tempy

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson


All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com