cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Error Type_E_ invalid state excel 0x80028029. " Automation error, Invalid forward reference, or reference to uncompiled type."

TaronWright2
Level 2

I'm having an issue with an excel workbook that occasionally runs into this error (Type_E_ invalid state excel 0x80028029) " Automation error, Invalid forward reference, or reference to uncompiled type." 

To give some context to the issue. I'm using the Excel VBO which I have extended by writing my own VB code. This extended code is used extensively to interact with the workbook. The workbook I'm interacting with is also on a network drive, so properly closing and saving the workbook file after the process has completed takes a couple of seconds. The process I have built opens and closes the workbook a lot, as it runs small data insertion entries into the workbook.

The issue seems to only appear when trying to close the workbook. However, the issue does not appear every time the workbook is being closed, only sometimes. Thus, the process with the extended code that I wrote could work 30 times, and then it will randomly fails the 31st time. This seems to corrupt the workbook, and makes the normal error handling of closing instances and the excel process invalid, as next time the bot tries to open the file it fails. 

A workaround was suggested on Stack Overflow (Invalid forward reference, or reference to uncompiled type) that works, where a user manual goes into the workbook where the user "enables the "AccessibilitycplAdmin 1.0 type admin" under Tools > References (within the VBA editor)". However, this requires manual intervention and also does not prevent the error from occurring again, it only fixes the workbook to the point where the bot can interact with it again

Stack Overflow remove preview
Invalid forward reference, or reference to uncompiled type
I'm currently using a code to update a file with a loop running through multiple sheets. Up until now, the code ran smoothly. On today's run, I encountered "run-time error '-2147319767 (80028029)'
View this on Stack Overflow >

 

If anyone has seen this issue before or might know a better approach to fixing it I would greatly appreciate it.

5 REPLIES 5

faheemsd
Level 6

Dear Taron,

Here are some steps you can take to troubleshoot and resolve this issue:

Check Excel Application: Ensure that Excel is installed and running properly on the machine where Blue Prism is executing the automation. Make sure there are no issues with Excel's installation or configuration.

Verify Workbook State: Check the Excel workbook that your automation is interacting with. Make sure the workbook is not in a corrupted state and that it can be opened and manipulated manually without any errors.

Close and Reopen Excel: If Excel is already running, try closing it and reopening it before executing the automation again. This can sometimes resolve issues related to Excel's state.

Check Excel VBO Configuration: If you're using Blue Prism's Excel VBO (Visual Business Object) to interact with Excel, double-check the configuration of the Excel VBO actions and parameters. Make sure they are set correctly and are compatible with the version of Excel you're using.

Review Automation Logic: Review the logic of your automation process that interacts with Excel. Check for any potential issues such as invalid Excel object references, incorrect workbook paths, or improper error handling.

Test with a Different Workbook: Try executing your automation with a different Excel workbook to see if the issue persists. This can help determine if the problem is specific to the workbook you're using or if it's a more general issue with Excel interaction.

Restart Blue Prism Services: Restart the Blue Prism Runtime Resource and other relevant Blue Prism services from the Blue Prism System Manager. Sometimes, restarting services can resolve intermittent issues.

TaronWright2
Level 2

Hi SYED, 

Thanks for your reply. I have tried everything you have mentioned and none of these have made a difference.

faheemsd
Level 6

Dear Taron,

If possible, could you, please uninstall and re-install the excel again and check the result?

Anton__Hosang
Level 5

Can you show the code that is being called?

Second, you probably have some code that is running without referenced worksheets and that causes the issue.

If your code stages contain something like this "Workbooks(...).Worksheets(sheetname).Range(....).SomeMethodCall()..." then you should try allocation to a variable. Unqualified members of the application etc, and Excel not handling the pace 🙂

Dim ws As Object, wb As Object

wb = GetWorkbook(....)

ws = wb.Worksheets(sheetname)

ws.Range(....).SomeMethodCall()...

TaronWright2
Level 2

Hi Anton,

For most of my process I actually do use a worksheet object as reference to the main worksheet I work with. However, there is a stage in my code where I do interact with a different sheet with code like "wb.Worksheets("Sheet 2").Activate"  and "wb.Worksheets("Sheet 2").Cells(1,0) = value" and I proceed to interact with the worksheet through this manner. I will change the code to store this worksheet as its own object and see if it works. Thanks for the suggestions!