Strange case here. When I use RDP to log in to the EasyMorph server (Administrator account) the process works fine with the Excel VBA command. But when run as a job it fails. It does not seem to open the Excel file. Excel has been installed of course (Office 2021 Home edition).
The EasyMorph service uses account ‘Local Service’. And this account has been given acces to the Excel file. I’ve tested with worker Administrator and Local service. Both fail with the same error.
This is the logging:
12-09-2022 13:34:16 000041 ERROR Run completed with 1 errors:
12-09-2022 13:34:16 000042 ERROR Error: Microsoft Excel kan geen toegang verkrijgen tot het bestand C:\EasyMorph\Local space\test.xlsm. Er zijn verschillende mogelijke oorzaken:
• De naam van het bestand of het pad bestaat niet.
• Het bestand wordt gebruikt door een ander programma.
• De werkmap die u probeert op te slaan heeft dezelfde naam als een werkmap die reeds is geopend.
12-09-2022 13:34:16 000043 ERROR Source: action “Excel command”, table “Table 1”
It’s quite a basic default error message without many details.
Microsoft Excel can not access the file. There are several possible causes:
The file name or path does not exist
The file is being used by another program.
The workbook you are trying to save has the same name as a workbook that is already open.
I’ve ruled out these possible causes. But still it seems EasyMorph cannot acces the file.
The file is located on the C: drive. A 64bits version of Excel is installed on the server.
I’ve used this article to troubleshoot, but unfortunately without result:
Don’t know if this is relevant, but have you previously opened this Excel file directly on the system that Server is running on? Looking at the Excel file security angle.
Normally when you open an xlsm file for the first time as a specific user, you are met with the old “contains macros, allow or deny” message/notification. If this hasn’t been done and cleared (accepted), maybe it’s hung there? Open the file directly, clear/accept macros, save and close. Then try again?
Latest “security” is for files that were retrieved from an external/web location (or perceived to be external), Excel will “lock it down” until you “unblock” it. In File Explorer, find the file. Right-click and select Properties. Look for an “Unblock file” checkbox at the bottom-right corner of the “General” tab. If there, check it and hit OK. If not there, you’re good.