Ok, I've just done this today.
Excel cant' read command line parameters but it can read environment variables..
I created a VBS script which sets an environment variable with the cell address that you want - this is passed as a command line parameter to the scrip so that you can change it with each shortcut that you have.
ExcelB.vbs:
' Starts Excel, opens a file and passes a parameter to Excel via environment variable
' Syntax: ExcelB.vbs FileName Parameter
'Write to environment variable - from the 2nd command line parameter: Item(1)
'Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Environment("PROCESS").Item("ExcelParam") = WScript.Arguments.Item(1)
'open Excel with the filename passed from the 1st command line parameter: Item(0)
Set objShell = CreateObject ("WScript.Shell")
Set objExec = objShell.Exec ("C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE " & WScript.Arguments.Item(0))
In Excel, create VBA code to read the environment variable and goto the desired cell
Private Sub Auto_Open()
Dim sParam As String,
Dim sCell As String
Dim sCellR1 As String
sParam = Environ("ExcelParam")
If Left(sParam, 1) = "#" Then
sCell = Mid(sParam, 2, 200)
sCellR1 = Application.ConvertFormula(sCell, xlA1, xlR1C1)
Application.Goto sCellR1
End If
End Sub
I've designated a '#' symbol as a trigger for "goto a cell", so that other commands could be added if required
This is also in keeping with MS standards (if you create a hyperlink to a cell in Excel and then examine the hyperlink you will see that it uses this same format)
Lastly, you'll need to create Shortcuts in Windows File Explorer with the following format for the 'Target' setting in the shortcut:
C:\ExecelB.vbs C:\testfile.xlsm #Sheet2!A3
And there you have it - Windows Shortcuts which will open an Excel spreadsheet to a specific sheet/cell
The only condition is that the Excel spreadsheet must not be already open.
I'm sure someone could improve on this to make it also work if the file is open.
Hope this helps
regards, Phil (in Australia)