VBA text box fill Properties

VBA text box fill Properties

j.romo
Advocate Advocate
2,753 Views
3 Replies
Message 1 of 4

VBA text box fill Properties

j.romo
Advocate
Advocate

Hello guys

Here I am struggling again

I mannaged to make a button to create some iproperties in VBA in a user form, but now I want to have some Textboxes to fill the value of the iproperties

but I can¡t get arroud it

 some hel would be great

the custom property is telephone

 

 

thanks

 

Private Sub TextBox1_Enter()

  Dim invDoc As Document
    Set invDoc = ThisApplication.ActiveDocument
    
    ' Get the design tracking property set.
    Dim invDesignInfo As PropertySet
    Set invDesignInfo = invDoc.PropertySets.Item("Design Tracking Properties")
    
    ' Get the part number property.
    Dim invPartNumberProperty As Property
    Set invPartNumberProperty = invDesignInfo.Item("TELEPHONE")
    
 invPartNumberProperty.Value
    
    
End Sub

0 Likes
Accepted solutions (1)
2,754 Views
3 Replies
Replies (3)
Message 2 of 4

b_sharanraj
Advocate
Advocate

Hi @j.romo

 

Please look into the below pic from the Toolbox Controls you can add a Textbox to Userform 🙂

 

IMG_20170815_083602.jpg

 

 

Regards

B.Sharan Raj

0 Likes
Message 3 of 4

MechMachineMan
Advisor
Advisor

It also helps if you access the proper property set: "Inventor User Defined Properties" instead of "Design Tracking Properties".

 

See this blog: http://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 4 of 4

j.romo
Advocate
Advocate
Accepted solution

Ifound out how to do it

I Had to call the textbox1.value to insert the value typed in the textbox to the iproperty the code is like this.

the link is very helpfull justin...

Private Sub CommandButton2_Click()
 
    ' Get the active document.
    Dim doc As Document
    Set doc = ThisApplication.ActiveDocument

    ' Get the custom property set.
    Dim customPropSet As PropertySet
    Set customPropSet = doc.PropertySets.Item( _
    "Inventor User Defined Properties")

    ' Get the property named "TELEFONO".
    Dim customProp As Property
    Set customProp = customPropSet.Item("TELEFONO")

    ' Display the value of the iProperty.
    'MsgBox "TELEFONO = " & customProp.Value
    
     ' Set the value of the property.
    customProp.Value = TextBox1.Value
End Sub
0 Likes