Error: 213 - Excel object error. Run on server. UNC path

Agent is run on server and Excel is installed on the server. Same code runs successfully from Lotus Notes client. Error is only thrown when run on the server. Agent security level is 3 and signer has unrestricted rights.

Here is the error recorded in Log:

Error: 213: Microsoft Excel: Microsoft Excel cannot access the file ‘\appsrv01\SS\INVEXCEL\ITEMH.XLS’. There are several possible reasons:

• 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 currently open workbook.


I can open the file using the unc path when running Excel interactively on the server.

The string variable filenameNew$ is:

\appsrv01\SS\INVEXCEL\ITEMH.XLS


Here is code:

'*****

	' Detach Excel Template File to filenameNew$ path above.

	'*****	

	Set object = docProfile.GetAttachment(filename$)

	Call object.ExtractFile(filenameNew$)

	'******

	' Excel object creation and opening template workbook

	'******

	Dim oexcel As Variant

	Dim oworkbook As Variant	

	Set oexcel = CreateObject("Excel.Application")

	oexcel.Visible = False

	'<<<Error is thrown on next line>>>'

	Set oworkbook = oexcel.Workbooks.Open(filenameNew$)

	...