XLSPadlockAvailable() function stopped working


#1

Hi @gdgsupport and all,

I was trying to debug an issue with my app so I enabled access to the VBE temporarily in order to step through. One problem I’ve never experienced before was that the app didn’t know that it was a protected app.

When I tried this function, it was returning False even though it was a secured application.

If XLSPadlockAvailable() Then
'do stuff
Else
'it went here for some reason
End If

The function I have for this is below:
Public Function XLSPadlockAvailable() As Boolean
Dim XLSPadlock As Object
On Error Resume Next
Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
XLSPadlockAvailable = XLSPadlock.IsProtected()
End Function

I was having trouble accessing c:\Program Files (x86)\MyAppName\ folder, so I decided to tell my computer to always run this as an Administrator in the properties. I’m not sure if this is why the function is no longer working.

Please advise.

Thanks

Dan


#2

QUICK UPDATE
I did some testing and sure enough, if I check this:

then the function XLSPadlockAvailable returns False, and when it is unchecked, the function returns True.

Is there another way to let my app have access to Program Files without opening as admin and thus ruining this function? Or is there a way to fix the function?

Thanks

Dan


#3

Running an EXE with administrative rights can cause trouble indeed. That’s why we added a new option that will prevent this in XLS Padlock 2019.

No, it’s not possible to write to Program Files without being an admin or with an elevated process. That’s why a lot of apps now install to the local AppData folder of the user and no more in Program Files. You should look into that solution too.


#4

Hi @gdgsupport,
Thanks for your info and 1st class support as usual!

I ended up resolving this by using the Temp folder, however, the AppData would be a great idea also.

Thanks!
Dan