I’ve inherited an application that was running on Xojo Ancient ™ and Windows Double Ancient ™ that’s been moved and recompiled to a new Windows machine with new Office. Now when the application runs as my user (creates a web interface, populates Excel for download) it works fine. When it runs as a service (as it’s supposed to as a web thing) it returns -2147417851 as an excel error message. I don’t know enough about Xojo and office to troubleshoot, may I have help please?
I resolve it with grants the right privilege and verify the files.
In my case, the software in cause try to access a file that not exist, and throw this error
Yup, I run the compiled XOJO with “–secureport=#####” to make it run as a self contained web app w’ certificates etc. I’ve cut it down to the following debug code to replicate the error:
Dim excel As New ExcelApplication
dim StepMe as String
StepMe = “1”
…
StepMe = StepMe + “3”
System.DebugLog(“Step 3”)
StepMe = StepMe + “.” + excel.Version + “.”
…
Exception err As OLEException
System.DebugLog("Failed in creating the Excel " + err.Message + “|(” + StepMe + “)”)
It responds with
Failed in creating the Excel Unknown error: -2147418111, (Failed on “Version”)|(123)
As stated, when I start the application when logged in as myself, it works fine. When it starts as a windows service, it fails with the above. I’ve had someone who knows more about windows permissions than me look at it, and they are also stumped. I run the version in the same directory as the service-run version.
I’ve tried Googling the error, a lot of it comes back with permissions (which don’t look to be the issue) and others come back with OLE versions. I would think that having the above fail at the excel object step it’s an Excel issue rather than permissions?
Do you have access to the old machine? If so, what does the service RunAs compared with your new machines service? Is Excel installed for all users if its running as a different user?
I’m quite curious why it’s working when I run it from the command prompt, but not when the service runs it. I mean, that does sound like permissions - but it’s failing on excel.Version. That indicates to me it’s an Excel plugin or OLE issue; but why would the service execution have that and not my account?
Yes. We’ve tried it as Local Account and we’ve tried it running as my user.
Further debugging, I moved my step up to where I Dim excel:
' DEBUGGING
dim StepMe as String
StepMe = "0"
System.DebugLog("Step 0")
Dim excel As New ExcelApplication
StepMe = "a"
System.DebugLog("Step a")
And the first failure I get is
[#] Step 0
[#] Failed in creating the Excel Unknown error: -2147417846|(0)
So is there a likelihood the service is looking at a difference place for the plugin compared to my user? Referencing Georgios’ suggestion I am still logged in when this service is running, so it doesn’t look like the console is the issue.
Addition: I’ve added in a New WordApplication step and that has worked.:
' DEBUGGING
dim StepMe as String
StepMe = "0"
System.DebugLog("Step 0")
Dim word as New WordApplication
StepMe = "z"
System.DebugLog("Step z")
Dim excel As New ExcelApplication
StepMe = "a"
System.DebugLog("Step a")