Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations pierreick on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Property problems in VBA Code

Status
Not open for further replies.

sanders720

Mechanical
May 22, 2003
4
I have some code for properties that looks line this:

Dim i As Integer

Debug.Print "*** PROPERTIES FOR oProp1 ***"
For i = 1 To oProp1.Count
Debug.Print i, oProp1(i).Name, oProp1(i).Value
Next i

Debug.Print "*** PROPERTIES FOR oProp2 ***"
For i = 1 To oProp2.Count
Debug.Print i, oProp2(i).Name, oProp2(i).Value
Next i

Debug.Print "*** PROPERTIES FOR oProp3 ***"
MsgBox oProp3.Count
For i = 1 To oProp3.Count
Debug.Print i, oProp3(i).Name, oProp3(i).Value
Next i

Debug.Print "*** PROPERTIES FOR oProp4 ***"
For i = 1 To oProp4.Count
Debug.Print i, oProp4(i).Name, oProp4(i).Value
Next i

The code produces the results below. The problem is in the oProp3 section, where there are 29 items. For some reason, the code locks up after item 13 and doesn't produce item 14, which is supposed to be then Description. Instead, I get a run-time error of:

Run-time error '91':
Object variable or With block variable not set

Thanks for any help you can provide...




*** PROPERTIES FOR oProp1 ***
1 Title
2 Subject
3 Author sanders
4 Keywords
5 Comments
6 Last Saved By 0
7 Revision Number
8 Thumbnail -249163330
*** PROPERTIES FOR oProp2 ***
1 Category
2 Manager
3 Company
*** PROPERTIES FOR oProp3 ***
1 Creation Time 6/26/2003 10:24:13 AM
2 Part Number 99999-0022
3 Project was here
4 Cost Center
5 Checked By
6 Date Checked 1/1/1601
7 Engr Approved By
8 Engr Date Approved 1/1/1601
9 User Status
10 Material Silver
11 Part Property Revision Id {74747AB3-202E-44A4-ADE8-761D9A32CAE6}
12 Catalog Web Link
13 Part Icon
 
Replies continue below

Recommended for you

I'm not an Inventor expert, so this is just a guess (I wonder why I'm even in this forum...). Anyway, just looking at your code, it looks like the oProp4 object is not initialized. Is there some code earlier on in the form of:

Set oProp4 = Inventor.something-or-other

or something like that?

Its a bit strange since oProp1 to oProp3 work. Hopefully its not a bug in the API.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor