Excel Workbook Desktop Shortcut with Auto password?
7,462
There is no direct way, but with a little coding, you can get Excel to process command line parameters and open it from a launcher spreadsheet.
Using a shortcut that looks like this:
"C:\Program Files\Microsoft Office\Office12\EXCEL.EXE" /e/myfilename/mypassword "C:\MyExcelFiles\test.xlsb"
You can use the following code to get the command line - you will then have to extract the parameters you passed with /e, as the whole line gets returned
Declare Function StrLenA Lib "kernel32.dll" Alias "lstrlenA" (ByVal Ptr As Long) As Long
Declare Function GetCommandLineA Lib "kernel32.dll" () As Long
Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Function GetCommandLine() As String
Dim CmdStr As Long
Dim N As Long
Dim Buffer As String
CmdStr = GetCommandLineA 'Get a pointer to a string, which contains the command line
N = StrLenA(CmdStr) 'Get the length of that string
Buffer = String(N, Chr$(0)) 'Create a buffer
CopyMemory ByVal Buffer, ByVal CmdStr, N 'Copy to the buffer
GetCommandLine = Buffer
End Function
Related videos on Youtube
Author by
owenmelbz
Updated on September 18, 2022Comments
-
owenmelbz over 1 year
I've got a bunch of password-protected Excel workbooks on my secured LAN (no wan) computer.
Is it possible to parse the password into a shortcut so it would automatically open a workbook as long as the password is correct?
For example:
"S:\resources\Audit.xls" -password "mypass"
-
CharlieRB almost 12 yearsCan you please clarify; is the file password protected on open or just the sheets within the workbook are protected? There is a big difference between the two.
-
-
datatoo almost 12 yearsseems like an answer
-
ChrisZ over 4 yearsI am new to this but I need this solution.. How can I execute this?