Hallo,
I want also save a secured sheet without a message box with as san message
Public Function SaveSecureWorkbookToFile(Filename As String)
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLS.gxlsPlock”).Object
SaveSecureWorkbookToFile = XLSPadlock.SaveWorkbook(Filename)
Exit Function
Err:
MsgBox "Function SaveSecureWorkbookToFile NOT ok"
SaveSecureWorkbookToFile = ""
End Function
Sub TestSave()
SaveSecureWorkbookToFile (“R:\my save.xlsc”)
End Sub
When is the error handling is disabled. The Runtime error “9” disappears, at
Set XLSPadlock = Application.COMAddIns(“GXLS.gxlsPlock”).Object
The add-in you mentioned is a built-in one and is only available at runtime (when compiled in the EXE). At design time, in
Excel, an error will be triggered. That’s why you have to use On Error GoTo Err
Hi. I´ve been recently trying to use your new save function “Save changes automatically and load them without prompt next time” on my compiled .exe VBA project. However without success. On userform_terminate I would like to automatically save the file so all the changes within workbook will be available next time I run my .exe file.
Still doesn´t work for me. I made a new simple vba to check whether there is a issue with my code however it seems to be doing exactly the same. The VBA consists of userform with one textbox. Anything what I write to textboxt gets written in A1 cell. Once I cancel the userform the workbook gets saved. If I do that in excel anytime I open the workbook again the last input remains in the cell as it should be. However if I do it with compiled .exe file the save function doesn´t seem to be working. Code below.
Private Sub Workbook_Open()
UserForm1.Show
End Sub
Private Sub TextBox1_Change()
Sheets(“List1”).Range(“A1”) = TextBox1
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ThisWorkbook.Close Savechanges:=True
End Sub
Hi, JanJ
I saw your string of messages with gdg and I’d like to know if you simply inserted the function and made the variable Filename includes the whole name of the file with the extension .xlsc?
I greatly appreciate your feedback because I am having VBA error saying the variable XLSPadlock was not declared.
Thanks a million.
Roberto
Public Function SaveSecureWorkbookToFile(FileName As String)
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns("GXLS.GXLSPLock").Object
SaveSecureWorkbookToFile = XLSPadlock.SaveWorkbook(FileName)
Exit Function
Err:
SaveSecureWorkbookToFile = ""
End Function
Hi Skoriq,
Didi you solve your issue? because I am having the same and I’d like to know your process worked out.
Thanks in advance. Have a great day.
Roberto
Hi nd09,
Did you sole the issue with saving the file into the .xlsc?
Have you received a VBA error saying “Variable not defined” and pointing into the “XLSPadlock” below?
Set XLSPadlock = Application.COMAddIns("GXLS.GXLSPLock").Object