Hello:
I created an EXE file from XLS Padlock. When it opens, it does a few things and then the user is prompted to save the file with a new path and name. I want to save it as a protected XLSC file. I copied the code from the user manual, but no file is created. Do I need to add any COM items to my References? It appears that just adding the code didn’t work.
It fails on the following statement:
Set XLSPadlock = Application.COMAddIns(“GXLS.GXLSPLock”).Object
Also, the variable XLSPadlock was not defined, so I made it a Variant. That didn’t work, then I defined it as an AddIn. That also didn’t work. So apparently ComAddins(“GXLS.GXLSPLock”) is mssing.
Here’s the code:
Function CreateNewBid() As Workbook
Dim xlBidBook As Workbook
’ *********************************************************
’ Create a new Bid workbook from the template
’ *********************************************************
Range(“TemplateOrBid”) = "Bid"
ThisWorkbook.Sheets(“BidItemTemplate”).Visible = False
ThisWorkbook.Sheets(“MenuMaps”).Visible = False
End Function
Public Function SaveSecureWorkbookToFile(Filename As String)
Dim XLSPadlock As Variant
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLS.GXLSPLock”).Object
SaveSecureWorkbookToFile = XLSPadlock.SaveWorkbook(Filename)
Exit Function
Err:
SaveSecureWorkbookToFile = ""
End Function
I created an EXE file from XLS Padlock. When it opens, it does a few things and then the user is prompted to save the file with a new path and name. I want to save it as a protected XLSC file. I copied the code from the user manual, but no file is created. Do I need to add any COM items to my References? It appears that just adding the code didn’t work.
It fails on the following statement:
Set XLSPadlock = Application.COMAddIns(“GXLS.GXLSPLock”).Object
Also, the variable XLSPadlock was not defined, so I made it a Variant. That didn’t work, then I defined it as an AddIn. That also didn’t work. So apparently ComAddins(“GXLS.GXLSPLock”) is mssing.
Here’s the code:
Function CreateNewBid() As Workbook
Dim xlBidBook As Workbook
’ *********************************************************
’ Create a new Bid workbook from the template
’ *********************************************************
Range(“TemplateOrBid”) = "Bid"
ThisWorkbook.Sheets(“BidItemTemplate”).Visible = False
ThisWorkbook.Sheets(“MenuMaps”).Visible = False
Code:
'ThisWorkbook.SaveAs NewBid.TextPath, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
NewBid.TextPath = Replace(NewBid.TextPath, "xlsm", "xlsc")
SaveSecureWorkbookToFile NewBid.TextPath
Set xlBidBook = ThisWorkbook
Set CreateNewBid = xlBidBook
CreateMasterSheets xlBidBook
SetNewBidValues xlBidBook
DiagnoseCell ActiveCell
Application.ScreenUpdating = True
Exit Function
Public Function SaveSecureWorkbookToFile(Filename As String)
Dim XLSPadlock As Variant
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLS.GXLSPLock”).Object
SaveSecureWorkbookToFile = XLSPadlock.SaveWorkbook(Filename)
Exit Function
Err:
SaveSecureWorkbookToFile = ""
End Function
Last edited: