Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change Excel Table reference

0 REPLIES 0
Reply
Message 1 of 1
F.Goncalves
191 Views, 0 Replies

Change Excel Table reference

Hi,

I have one General Table in a Drawing that is referenced to an Excel file. But I want to change the reference from 11.xlsx to another file named 12.xlsx

 

For now I have this code that I saw in some forums



DimexcelFileNameAsString=ThisDoc.Path
DimtitleAsString
excelFileName=excelFileName&"\11.xlsx"
title="ASME"

DimdocasDocument=ThisDoc.Document
ForEachdSheetAsSheetIndoc.Sheets
ForEachtableAsCustomTableIndSheet.CustomTablesIf(table.TableSource<>TableSourceTypeEnum.kExcelTableSource)ThenContinueFor
DimfileDescAsFileDescriptor=TryCast(table.ReferencedDocumentDescriptor, FileDescriptor)
If(fileDescIsNothing)ThenContinueFor
fileDesc.ReplaceReference(excelFileName)
table.Title=title

Next
Next

but it is always giving me an error: "

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))"

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
--
F.Goncalves
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report