How to assign File > SAVE Button to my own Save Icon


#1

Hello Support,

I have a workbook that the ribbon is hidden and you cannot access the “File>Save” without showing the ribbon and I don’t want to do that. I have assigned Thisworkbook.Save to my own SAVE Button but it is not saving the file at all if I don’t save the file using the “File>Save” first before calling own code “Thisworkbook.Save”.

Assign%20SaveBtn1

Is there any procedure to call the save function to work the same with “File>Save” as shown in the picture.

Thanks,


#2

Try to turn off the following highlighted option:
image


#3

Hi,

Thanks for the reply

I have tried to disabled that tickbox but it doesn’t save the file. It seems that it is saving but when I reopen the file nothing changed.

I also tried this code below as workaround to call Save As secure file. (Allow secure save & Allow save but do not handle loading/saving turned on with vba SetOption Helper also turned on) and this works fine.

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

Sub SecureSaveAs()
Dim pathandname As String
Dim SecureFname As String
SecureFname = Application.GetSaveAsFilename( _
fileFilter:=“SmartCAL-Load Secure Files (*.scl), *.scl”)
If SecureFname = “False” Then Exit Sub
pathandname = PathToFile(SecureFname)
SaveSecureWorkbookToFile SecureFname
MsgBox "Secure File successfully saved in: " & vbNewLine & vbNewLine & pathandname, vbInformation, “SmartCAL-Load: Save As Secure File”
End Sub
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

Off topic question: Is there any way to for the end user to modify the original workbook with or without the secure file?

Thanks and Best Regards


#4

The secure file is just an encrypted version of the modified workbook. Secure files can only be opened with your EXE. When an end user runs the EXE, they are prompted to choose whether they want to open a secure file or the original workbook that you compiled as an EXE.