Scotster
Board Regular
- Joined
- May 29, 2017
- Messages
- 59
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I've never had a problem creating shortcuts using VBA but I'm a bit stumped at how to create a shortcut that has 2 parts to it.
The end result, and the shortcut that I currently have working that I made manually, has a target path as follows:
"C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE" "https://site.sharepoint.com/Filepath/File.xls"
When I attempt to use that as the target path programmatically, I get an error. My guess is it's due to the 2 part nature of the string, with the space in the middle. So I started playing around and gave the following a go:
And a few others that I can't remember. I've tried extracting the targetpath from the current working shortcut but it only pulls the first part of the path "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE", ignoring the latter half.
Is there a way of programmatically creating this shortcut path?
The end result, and the shortcut that I currently have working that I made manually, has a target path as follows:
"C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE" "https://site.sharepoint.com/Filepath/File.xls"
When I attempt to use that as the target path programmatically, I get an error. My guess is it's due to the 2 part nature of the string, with the space in the middle. So I started playing around and gave the following a go:
Code:
TargetPath = """C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"" ""https://Site.sharepoint.com/Filepath/File.xls"""
TargetPath = "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE" & " " & "https://Site.sharepoint.com/Filepath/File.xls"
TargetPath = "'C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE' 'https://Site.sharepoint.com/Filepath/File.xls'"
And a few others that I can't remember. I've tried extracting the targetpath from the current working shortcut but it only pulls the first part of the path "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE", ignoring the latter half.
Is there a way of programmatically creating this shortcut path?