iLogic Error: HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED

iLogic Error: HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED

chayman
Enthusiast Enthusiast
5,020 Views
10 Replies
Message 1 of 11

iLogic Error: HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED

chayman
Enthusiast
Enthusiast

I am trying to write to an excel spreadsheet with the following iLogic code:

 

SyntaxEditor Code Snippet

xlsPath = "C:\Users\dgauthier\Desktop\Inventor Templates\Ahu's\AHU Horizontal"

GoExcel.CellValue(xlsPath, "Model Parameters", "B2") = OA_WIDTH
GoExcel.CellValue(xlsPath, "Model Parameters", "B3") = OA_LENGTH
GoExcel.CellValue(xlsPath, "Model Parameters", "B4") = OA_HEIGHT

GoExcel.Save
GoExcel.DisplayAlerts = False

 

I believe I have done everything write and when I hit "OK" the following error codes appears:

 

Error in rule: Parameters, in document: Assembly1

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

 

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
at iLogic.GoExcel.SetCurrentSheet(String fileName, String sheetName)
at iLogic.GoExcel.set_CellValue(String fileName, String sheetName, String cellAddress, Object value)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

Is there something I am missing here?

 

Craig H

 

0 Likes
Accepted solutions (1)
5,021 Views
10 Replies
Replies (10)
Message 2 of 11

mcgyvr
Consultant
Consultant

Do you have excel loaded on that machine?

If so what version.. Note: Inventor does not support Office 365 products..

 

Did you create that excel file already and name the sheet "Model Parameters"?

 

Your code works just fine for me..

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 3 of 11

chayman
Enthusiast
Enthusiast

Yes, I have Excel 2007 loaded on the machine and I am using Autodesk Inventor 2017. I do not have a subscription to Office 365.

 

And yes, I have already created the sheet "Model Parameters".

 

Weird how it works for you...I am still receiving the same error. Do you think it could be that I am using an old version of Excel?

0 Likes
Message 4 of 11

Curtis_Waguespack
Consultant
Consultant

Hi chayman,

 

I think your xlsPath needs a file name. This works for me.

 

 

xlsPath = "C:\TEMP\Book1.xlsx"

GoExcel.CellValue(xlsPath, "Model Parameters", "B2") = "Hello"
GoExcel.CellValue(xlsPath, "Model Parameters", "B3") = "World"

GoExcel.Save
GoExcel.DisplayAlerts = False

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 5 of 11

mcgyvr
Consultant
Consultant

Can you create threaded holes in a part?

 

FYI.. I'm using Excel 2007..

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 6 of 11

mcgyvr
Consultant
Consultant

@Curtis_Waguespack wrote:

Hi chayman,

 

I think your xlsPath needs a file name. This works for me.

 


http://inventortrenches.blogspot.com


I didn't need to specify the extension..

This worked just fine for me..

 

xlsPath = "C:\Users\brianb\Desktop\AHU Horizontal"

GoExcel.CellValue(xlsPath, "Model Parameters", "B2") = OA_WIDTH
GoExcel.CellValue(xlsPath, "Model Parameters", "B3") = OA_LENGTH
GoExcel.CellValue(xlsPath, "Model Parameters", "B4") = OA_HEIGHT

GoExcel.Save
GoExcel.DisplayAlerts = False

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 7 of 11

chayman
Enthusiast
Enthusiast

I put a a filename in the xls path...still receiving the same error.

 

SyntaxEditor Code Snippet

xlsPath = "C:\Users\dgauthier\Desktop\Inventor Templates\Ahu's\AHU Horizontal\Master_Template_AHU"

GoExcel.CellValue(xlsPath, "Model Parameters", "B2") = OA_WIDTH
GoExcel.CellValue(xlsPath, "Model Parameters", "B3") = OA_LENGTH
GoExcel.CellValue(xlsPath, "Model Parameters", "B4") = OA_HEIGHT

GoExcel.Save
GoExcel.DisplayAlerts = False

 

I tried just making a test file and called it Book1....same error.

 

Is it my excel version (2007)? 

0 Likes
Message 8 of 11

Curtis_Waguespack
Consultant
Consultant

Hi chayman & mcgyvr,

 

ooops! sorry for the distraction. Smiley Embarassed I interpreted "AHU Horizontal" as a folder name in the original post.

 

These post reports the same error: HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)

http://forums.autodesk.com/t5/inventor-customization/urgent-help-ilogic-failure-to-talk-to-excel-201...

http://forums.autodesk.com/t5/inventor-customization/ilogic-and-excel/m-p/5992872#M60983

 

the 1st suggests an bad install of Excel? ....I didn't read much further.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

 

 

 

 

EESignature

0 Likes
Message 9 of 11

mcgyvr
Consultant
Consultant
Accepted solution

@Curtis_Waguespack wrote:

Hi chayman & mcgyvr,

 

 

the 1st suggests an bad install of Excel? ....I didn't read much further.

 

 

  


Thats where I was going hence the question to see if they can create threaded holes.. 

"seems" like Inventor just doesn't know excel is there or something is registered incorrectly..

 

I'm not sure if there is a process to get Inventor to reregister and if that process checks/registers Excel during that process..

I thought people used to have problems if Excel was installed "after" Inventor as Inventor doesn't know Excel is installed because it went looking during installation and didn't find it do it didn't do "something" behind the curtains.. 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 10 of 11

Curtis_Waguespack
Consultant
Consultant

@mcgyvr wrote:

Thats where I was going hence the question to see if they can create threaded holes.. 

 

I thought people used to have problems if Excel was installed "after" Inventor ... 


 Hi mcgyvr,

 

Yep. It dawned on me that you were way out in front of it, after I searched the error. Smiley Embarassed

 

We used to have people switch to the admin profile on the machine then run Excel or Inventor ? (or Excel and Inventor ?) and then switch back to their user profile and that would "fix" things.

 

I don't know if that's valid any longer, but maybe something to try?

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 11 of 11

chayman
Enthusiast
Enthusiast

Thank you!

 

It turned out that I didn't have my Excel 2007 CLSID code registered correctly.

 

I had 3 Excel versions (1.5,1.6 & 1.7). I just followed the steps here: http://stackoverflow.com/questions/12957595/error-accessing-com-components.

Once I did a search in "regedit" with the error code that was displayed in inventor, it took me to my current version and all I had to do was delete 1.5 & 1.7.

 

Hope this prevents future headaches; thanks everyone for your help!