Excel command VBA not working


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”

Thanks and regards,

Hi Ruud,

For those of us who don’t speak Dutch, what do these error messages mean, roughly?

Yes, of course.

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:

Does the Server service account have access to the folder where the file is located? Note that the default LocalService account has fewer permissions than an Administrator.

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.


Thanks for the suggestions.

  • I will try first to create a EasyMorph account on the server (instead of using Administrator and/or Local Service) and give that account al the needed rights.
  • If that does not solve the problem we will try the suggestions from Craig.

Thanks, Ruud

Just an update:

I’ve followed all suggestions and also the new article from Dmitry gave a lot more insight (If you have problems running Excel Command on Server).

But unfortunately I was not able to solve the issue (same issue remains). I’m giving up since the functionality to use Excel macros is not really a must have and to invest more time in the issue is not worth it for us.

The issue seems to be related to the VM, Windows account and/or Excel. I don’t think it’s a EasyMorph issue.

Regards, Ruud

1 Like