'Connect Form Control Button to Public Function
I need to understand how to connect a form control button to a public function. I am attempting to create a button for users to 'save as' an exe file that can only be opened by a specific application.
I am still learning VBA and trying to use a public function for the first time.
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
Any help or suggestions are very welcome.
Solution 1:[1]
[Sorry, I tried to comment but I have not enough reputation (I know, and that's true)]
Try to create a sub() (no arguments) and insert your function in it. But you must find a way to pass the proper argument to the function.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wesley Lima |
