×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Get Property problems in VBA Code

Get Property problems in VBA Code

Get Property problems in VBA Code

(OP)
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  

RE: Get Property problems in VBA Code

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close