Get current workbook save file path



Purpose: get current workbook save file path

This lets you retrieve the path to the workbook save file that has been selected by the user at startup (if any).

Insert the following code:

Public Function GetSecureWorkbookFilename()

Dim XLSPadlock As Object

On Error GoTo Err

Set XLSPadlock = Application.COMAddIns("GXLS.GXLSPLock").Object

GetSecureWorkbookFilename = XLSPadlock.GetSaveFilename()

Exit Function


GetSecureWorkbookFilename = ""

End Function


The previous code can be tested with:


Sub Test_GetFilename()

 MyFile = GetSecureWorkbookFilename

 MsgBox (MyFile)

End Sub


Copyright © 2022 G.D.G. Software