1. Alon Evan
  2. PowerBuilder
  3. Monday, 6 November 2023 10:03 AM UTC

Hi,

I have an issue when opening an Excel file using OLE after a Windows update to 22H2 (build OS 19045.3448)

The issue occurs only when the program is called from the Windows Task Scheduler ( user session not open )

Connection to Excel seems to work, there is no error code, however opening the file fails:

l_ole.Workbooks.Open("c:\Temp\MyFile.xlsx")

PB Versions:  2017 R3 build 1858 - 2022 R2 build 2819 

Excel Version: 2013

Thanks

Alon Evan Accepted Answer Pending Moderation
  1. Monday, 6 November 2023 16:46 PM UTC
  2. PowerBuilder
  3. # 1

Andreas,

You were correct to check everything, there was an error from my side on the file name. However the issue is real, only the error message has changed.

Description: Microsoft Excel ne peut accéder au fichier « C:\Users\svc_chver_sqladm\temp\OrderBook_MEDIC.xlsx ». Plusieurs raisons sont possibles : • Le nom du fichier ou le chemin d'accès n’existe pas. • Ce fichier est actuellement utilisé par un autre programme. • Le classeur que vous essayez d’enregistrer porte le même nom qu’un classeur actuellement ouvert.


source: Microsoft Excel

 

Google translation for the description:

The file name or path does not exist.

This file is currently in use by another program.

The workbook you are trying to save has the same name as a currently open workbook.

 

Comment
There are no comments made yet.
Alon Evan Accepted Answer Pending Moderation
  1. Monday, 6 November 2023 13:05 PM UTC
  2. PowerBuilder
  3. # 2

 

oleExc.source: Microsoft Excel

oleExc.description: Désolé... Nous ne trouvons pas c:\temp\OrderBook_MEDIC.xlsx. Peut-être l'avez-vous déplacé, renommé ou supprimé ?

Description is in french, saying the system can't find the file. This is incorrect given that the same code works fine when called from an open windows session. It also worked fine before the windows update.

Comment
  1. Andreas Mykonios
  2. Monday, 6 November 2023 13:46 PM UTC
Can you try to place it somewhere else (maybe in a folder under the current user profile)? Just as a test...
  1. Helpful
There are no comments made yet.
Alon Evan Accepted Answer Pending Moderation
  1. Monday, 6 November 2023 11:22 AM UTC
  2. PowerBuilder
  3. # 3

Thank Andreas,

I'm not getting much more information:

Error calling external object function open at line 19 in function of__send_batch of object nv_batch_send

Comment
  1. René Ullrich
  2. Monday, 6 November 2023 12:18 PM UTC
Check oleExc.description
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 6 November 2023 10:59 AM UTC
  2. PowerBuilder
  3. # 4

Hi.

In your try catch block add:

//
CATCH (oleruntimeerror oleExc)
	messagebox("", oleExc.source + " / " + oleExc.text)
//...

Place it as first catch statement in the block...

Andreas.

Comment
  1. René Ullrich
  2. Monday, 6 November 2023 11:16 AM UTC
... and especially oleExc.description
  1. Helpful 2
There are no comments made yet.
Alon Evan Accepted Answer Pending Moderation
  1. Monday, 6 November 2023 10:22 AM UTC
  2. PowerBuilder
  3. # 5

I get an "Error calling external object function open at line 19" inside the CATCH clause. Not sure how to catch an OLERuntimeError

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 6 November 2023 10:14 AM UTC
  2. PowerBuilder
  3. # 6

How does it fail? Do you get an exception? 

Have you tried to catch OLERuntimeError excpetion to get more information about the reason in the "description" property?

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.