ms excel open workbook error message

hi. i have a problem, i am now learning ms excel vbo, but i just cannot use the open workbook action. i get error "Internal : Could not execute code stage because exception thrown by code stage: Exception has been thrown by the target of an invocation."

i dont know why. i know the file path is correct since i tried using file management - file exists.
what is wrong? i am getting the same error message when doing this on my vdi
View attachment 1597233370528.png
 
Last edited:

Jothin Georgi

New Member
Hi Hicke,

1. Try opening the excel manually after closing the instance properly and check if the excel file is corrupted or there is any pop up while opening the excel. If there is any pop-up, the open workbook stage won't work. Try turning off the excel alerts using the below code in the open workbook code stage.

Dim excel As Object = GetInstance(handle)
excel.AskToUpdateLinks = False
excel.DisplayAlerts = False
Dim wb as Object = excel.Workbooks.Open(filename)
name = wb.Name
wb.Activate()
excel.DisplayAlerts = True
excel.AskToUpdateLinks = True


2. Please share a screenshot of the open workbook stage and also verify the object used to create instance and open workbook are the same.
 

Attachments

  • Open Workbook Without Alert.PNG
    38.8 KB · Views: 17

Pete_L

Active Member
Please post a screenshot of the configuration of your Open Workbook stage.

Some common issues with Open Workbook:
1. your Create Instance stage will have Handle as output. Save it in a data item of type Number called "Handle".
2. The Open Workbook stage needs to be configured to reference Handle.
3. The Open Workbook's input "File Name" must include the full path and filename of the Excel file you want to open.
4. The Open Workbook's input "Workbook Name" is just the filename without the path.

Hopefully, one of these items will help you resolve the error. If not, please post that screenshot. :)
 
Top