Excel file in .idw w/ iLogic doesn't work

Excel file in .idw w/ iLogic doesn't work

6.Day.Old.Filet-O-Fish
Enthusiast Enthusiast
369 Views
4 Replies
Message 1 of 5

Excel file in .idw w/ iLogic doesn't work

6.Day.Old.Filet-O-Fish
Enthusiast
Enthusiast

I am trying to create a .idw template. I have an embedded excel file saved with data which I'd like to use to enter additional information, which that can then be used to create tables, as native excel is unacceptably ugly and difficult to use in .idw's.

 

The proper code should be

goexcel.cellvalue("3rd Party:Embedding1","Sheet1, "A1")

 

It's in the documentation but it inexplicably does not work. This has been a problem for a decade but has this ever been fixed? What is the work-around?

 

Complicating this is that there is no 'link' in parameters/f(x) under drawings...

 

Anyone who can figure out how to do this simple task will be my hero.

0 Likes
Accepted solutions (1)
370 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor

Please send me you idw, and explain exact what needs to be read from the xls file an where to put. This should be not to difficult!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 3 of 5

6.Day.Old.Filet-O-Fish
Enthusiast
Enthusiast

I appreciate the help. I cannot share files from our work network.

 

However, there is very little to recreating. Simply make a fresh .idw, add a new excel object into it (thru insert object), put in some random data and save, then try to pull from the imbedded excel file w/ iLogic.

 

I've worked with linked and external excel docs in assemblies and have never had this problem. But as this is meant to be a drawing template for others with no iLogic experience to use, it needs to be embedded. This will be a project cover page with tables of all drawings, drawing #s and Revs.

 

I already have the iLogic for pulling/displaying the relevant info. I just cannot actually access the excel file.

 

Thanks again for your help.

0 Likes
Message 4 of 5

Accepted solution

Here you have the solution:

bradeneuropeArthur_0-1710796918943.png

AddReference "Microsoft.Office.Interop.Excel"
'Imports Inventor
'Imports Microsoft.Office.Interop.Excel

Sub main
	OpenEmbeddedExcelWorkbook(ThisApplication)
End Sub

    Public Sub OpenEmbeddedExcelWorkbook(oInvapp As Inventor.Application)
        Dim fi As System.IO.FileInfo
        fi = New System.IO.FileInfo(oInvapp.ActiveDocument.FullFileName)

        If fi.IsReadOnly = False Then
            Dim oOleRef As Inventor.ReferencedOLEFileDescriptor
            oOleRef = oInvapp.ActiveEditDocument.ReferencedOLEFileDescriptors.Item(1)
			MsgBox (oOleRef.DisplayName)
            Dim owb As Microsoft.Office.Interop.Excel.Workbook
            oOleRef.Activate(OLEVerbEnum.kHideOLEVerb, owb)
			Dim s As Microsoft.Office.Interop.Excel.Worksheet
			MsgBox (owb.Worksheets.Count)
			s = owb.Worksheets.Item(1)
			Dim r As Microsoft.Office.Interop.Excel.Range
			r = s.Range("A2")
			MsgBox(r.Value)
			r2 = s.Range("B2")
			MsgBox (r2.Value)
        Else
            MsgBox("File is read Only", MsgBoxStyle.Information & vbOK, "File is Read only")
        End If
	End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 5

6.Day.Old.Filet-O-Fish
Enthusiast
Enthusiast

👀👀👀

You're amazing! Worked perfect right out the gate and super clear.

Thank you!