Kentetsu
Well-known Member
- Joined
- Jan 22, 2004
- Messages
- 520
Hello,
I've been searching all morning, but can't quite find what I need.
I've got a bit of code that creates a shortcut on the user's desktop. I need to modify it so that it creates a shortcut that opens the file as Read Only.
As you can see, I've tried a few variations (commented out) that all failed to work.
I'm not too sure on my Dim statement for r either (as long?).
Thank you...
I've been searching all morning, but can't quite find what I need.
I've got a bit of code that creates a shortcut on the user's desktop. I need to modify it so that it creates a shortcut that opens the file as Read Only.
As you can see, I've tried a few variations (commented out) that all failed to work.
Code:
Option Explicit
Public Sub CreateShortCut()
Dim oWsh As Object
Dim oShortcut As Object
Dim sPathDeskTop As String
Dim r As Long
Set oWsh = CreateObject("WScript.Shell")
sPathDeskTop = oWsh.SpecialFolders("Desktop")
Set oShortcut = oWsh.CreateShortCut(sPathDeskTop & "\" & _
"Rack Tag & Track App" & ".lnk")
'ActiveWorkbook.Name & ".lnk")
With oShortcut
.TargetPath = "J:\ZZ PII Ovens\Batch Ovens PC\Oven Logs Database\Rack Issue Reporting.xlsm"
'.TargetPath = "J:\ZZ PII Ovens\Batch Ovens PC\Oven Logs Database\Rack Issue Reporting.xlsm" / r
'.TargetPath = excel.exe /r "J:\ZZ PII Ovens\Batch Ovens PC\Oven Logs Database\Rack Issue Reporting.xlsm"
'.TargetPath = "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" / r "J:\ZZ PII Ovens\Batch Ovens PC\Oven Logs Database\Rack Issue Reporting.xlsm"
'
'.TargetPath = "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" - r "J:\ZZ PII Ovens\Batch Ovens PC\Oven Logs Database\Rack Issue Reporting.xlsm"
.Save
End With
Set oWsh = Nothing
MsgBox "Shortcut Has Been Created Successfully", vbOKOnly
Application.DisplayAlerts = False
ThisWorkbook.Close , False
Application.DisplayAlerts = True
End Sub
I'm not too sure on my Dim statement for r either (as long?).
Thank you...