Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
checkcheck_master
1827 Views, 6 Replies

iLogic, how to get a Thumbnail to an Excel document?

This should work, but I get errors:
https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/getting-the-part-assembly-thumbnail/...
Type 'stdole.IPictureDisp' is not defined.
'Compatibility' has not been declared. It may be inaccessible due to its protection level.
See screenshot.

Public Function iThumbnail(FilePath As String) As System.Drawing.Image
	If Not System.IO.File.Exists(FilePath) Then Return Nothing
	Dim oImg As System.Drawing.Image = Nothing
	Try
		Dim iApp As New Inventor.ApprenticeServerComponent
		Dim oDoc As Inventor.ApprenticeServerDocument = iApp.Open(FilePath)
		Dim SummaryInfo As Inventor.PropertySet = oDoc.PropertySets.Item("Inventor Summary Information")
		Dim ThumbProp As Inventor.Property = SummaryInfo.Item("Thumbnail")		
		Dim Thumbnail As stdole.IPictureDisp = CType(ThumbProp.Value, stdole.IPictureDisp)
		If Not Thumbnail Is Nothing Then
			oImg = Compatibility.VB6.IPictureDispToImage(Thumbnail)
		End If
		oDoc.Close()
		iApp.Close()
	Catch Ex As Exception
		MsgBox(ex.Message)
	End Try
	Return oImg
End Function