As Alex K. said. This will save and retrieve values from the registry. For NameOfYourProject you might want to use the spreadsheet name or something.
SaveSetting "NameOfYourProject", "frmMain", "LastPath", szLastPath
szLastPath = GetSetting("NameOfYourProject", "frmMain", "LastPath", 0)
Here are the parameters for SaveSettings.
AppName
Required. String expression containing the name of the application or project to which the setting applies.
Section
Required. String expression containing the name of the section in which the key setting is being saved.
Key
Required. String expression containing the name of the key setting being saved.
Setting
Required. Expression containing the value to which Key is being set.
And these for GetSetting
AppName
Required. String expression containing the name of the application or project whose key setting is requested.
Section
Required. String expression containing the name of the section in which the key setting is found.
Key
Required. String expression containing the name of the key setting to return.
Default
Optional. Expression containing the value to return if no value is set in the Key setting. If omitted, Default is assumed to be a zero-length string ("").