Purpose: open an existing save file with VBA
It is possible to open a save file of your application using VBA code. However, please note that the file will be loaded in a new instance of Excel and not in the current instance. This is the same as starting the EXE file a second time.
Insert the following code (for instance in a module):
Public Sub LoadXLSPadlockSaveFile(FilePath As String)
On Error Resume Next
Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object
XLSPadlock.PLOpenSaveFile (FilePath)
End Sub
For instance, the following macro (to be associated to a button) will prompt end users for the XLSC save file they want to open, and then open it:
Sub Load_Old_Save()
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a save file to open", _
FileFilter:="Save Files (*.xlsc),*.xlsc")
If strFileToOpen = False Then
MsgBox "No file selected.", vbExclamation, "Error"
Exit Sub
Else
LoadXLSPadlockSaveFile (strFileToOpen)
End If
End Sub