[VBA] Thumbnail Image in a UserForm Inventor 2014

[VBA] Thumbnail Image in a UserForm Inventor 2014

Anonymous
Not applicable
1,276 Views
0 Replies
Message 1 of 1

[VBA] Thumbnail Image in a UserForm Inventor 2014

Anonymous
Not applicable

Hello to all,

 

I'm building a small menu box in VBA where i can select some file to import inside an assebly.

 

It would be nice if i can show a preview of the object selected through an IMAGEBOX whit the thumbnails of the files.

 

I read a lot in various sites about it but they seems to be related to old version of Inventor. 

http://modthemachine.typepad.com/my_weblog/2010/06/accessing-thumbnail-images.html

 

Now the code that i use is the follow:

 

Private Sub ListBox1_Click()

  Dim MyFile As String
MyFile = "URL WHERE THERE IS MY FILES\" + ComboBox1.Value & "\" + ListBox1.Value Set oDoc = ThisApplication.Documents.ItemByName(MyFile) Set Image1.Picture = oDoc.thumbnail End Sub

 This works well with component that are already been in Inventory cache (even if they are not currently open) but it doesn't works with the other component.

 

Even this doesn't works:

 

Private Sub ListBox1_Click()
  
  Dim MyFile As String

   MyFile = "URL WHERE THERE IS MY FILES\" + ComboBox1.Value & "\" + ListBox1.Value
    
Dim oApprentice As New ApprenticeServerComponent
' Open a document using Apprentice
Dim oApprenticeDoc As ApprenticeServerDocument
Set oApprenticeDoc = oApprentice.Open(MyFile)

Dim pict As IPictureDisp
Set pict = oApprenticeDoc.thumbnail
Image1.Picture = pict


oApprentice.Close
Set oApprenticeDoc = Nothing
Set oApprentice = Nothing

End Sub

 

 

 

How can i solve it? 

Many thankyou for the help

 

0 Likes
1,277 Views
0 Replies
Replies (0)