How to use PathToFile and SaveSecureWorkbookToFile together


#1

Hi there,

I’m struggling to make these two VBAs to work together.

What location or code I need to put inside the sub SaveSecureWorkbookToFile to save in the same location of the exe file?

I’m using:

Public Function PathToFile(Filename As String)
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
PathToFile = XLSPadlock.PLEvalVar(“EXEPath”) & Filename
Exit Function
Err:
PathToFile = “”
End Function

And

Public Function SaveSecureWorkbookToFile(Filename As String)
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLS.GXLSPLock”).Object
SaveSecureWorkbookToFile = XLSPadlock.SaveWorkbook(Filename)
Exit Function
Err:
SaveSecureWorkbookToFile = “”
End Function

and to call:

Sub Test_Save()
SaveSecureWorkbookToFile (WHAT SHOULD I PUT HERE)
End Sub

Thanks


#2

Try

Sub Test_Save()
SaveSecureWorkbookToFile (PathToFile("MySave.xlsc"))
End Sub

#3

Hi Support,

I figured out that actually you just need the file name inside the brackets, like SaveSecureWorkbookToFile (“MySave.xlsc”), and the xlsc file will get saved in the My Documents folder.

Two questions:

1) Can I assume this (file gets saved in the user’s My Documents folder) will happen to all users that run the macro?

2) And why when I reopen the EXE file and choose “Last save”, it doesn’t open the xlsc file saved through the SaveSecureWorkbookToFile macro? How to fix it?

Thanks,


#4

Sure, each user has its own My Documents folder.

That’s because SaveSecureWorkbookToFile doesn’t write a reference into the history file.


#5

So how can we overcome this? Is there a macro, or a line of code to write a reference into the history file?
If not, would that be possible to fix in the next XLS Padlock version?

Cheers,


#6

We’ll check this possibility for the next update.


#7

Thanks. The SaveSecureWorkbookToFile is useless if it makes harder to open the file. Getting this sorted would be great.

Just for my information, any idea when will be the new update available?

Cheers,