Access to the property field of the cartridge in vba

Access to the property field of the cartridge in vba

sebastien.forman
Advocate Advocate
690 Views
6 Replies
Message 1 of 7

Access to the property field of the cartridge in vba

sebastien.forman
Advocate
Advocate

Hello everybody.

I would like to know if it is possible to access and modify the field of the property of the cartridge.

As shown in the screencast.

This field is currently editable when the drawing is created.

I would like my vba code to fill it itself.

 

Thank you for your help.

 

 

 

 

0 Likes
Accepted solutions (1)
691 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor
Call oDrawDoc.ActiveSheet.TitleBlock.SetPromptResultText(oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(1), "This")
Call oDrawDoc.ActiveSheet.TitleBlock.SetPromptResultText(oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(2), "That")
Call oDrawDoc.ActiveSheet.TitleBlock.SetPromptResultText(oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(3), "and so on")


Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

sebastien.forman
Advocate
Advocate

something like that? (don't work)

 

edit: sorry i can not attach files for some bug reason

 

 

Sub updateiprop()
Dim a As Application
Set a = ThisApplication

Dim b As DrawingDocument
Set b = a.ActiveDocument

Dim Partnr As Property
Dim Desc As Property

Dim bx As Document
Set bx = b.ReferencedDocuments.Item(1)

MsgBox bx.FullDocumentName

Dim propset As PropertySet
Set propset = bx.PropertySets.Item("Design Tracking Properties")

Set Partnr = propset.Item("Part Number")
Set Desc = propset.Item("Description")

Dim Filen As String
Filen = b.DisplayName '"103-NiMo-10200-001 (Collection tank)" '

Dim strSp() As String
strSp = Split(Filen, " (")

MsgBox strSp(0)
MsgBox strSp(1)

Partnr.Value = strSp(0)
Desc.Value = Replace(strSp(1), ").idw", "")

Dim strSp2() As String
strSp2 = Split(Filen, "-")
MsgBox Filen
MsgBox strSp2(0)

Call b.ActiveSheet.TitleBlock.SetPromptResultText(b.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(1), "This")
Call b.ActiveSheet.TitleBlock.SetPromptResultText(b.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(2), "That")
Call b.ActiveSheet.TitleBlock.SetPromptResultText(b.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(3), "and so on")



a.ActiveDocument.Save2 (True)

End Sub

 

0 Likes
Message 4 of 7

bradeneuropeArthur
Mentor
Mentor
Accepted solution

use this:

 

Sub changePrompt()

  Dim doc As DrawingDocument
  Set doc = ThisApplication.ActiveDocument

  Dim tb As TextBox

  Dim i As Integer
  i = 1

  Dim border As TitleBlock
  Set border = doc.ActiveSheet.TitleBlock

  Dim borderDef As TitleBlockDefinition
  Set borderDef = border.Definition

  For Each tb In borderDef.Sketch.TextBoxes 'oDrawDoc.Sheets.Item(i).TitleBlock.Definition.Sketch.TextBoxes.count

      If tb.Text = "<DEPARTEMENT>" Then

         
Call border.SetPromptResultText(tb, "this is your string")
      End If

      i = i + 1

  Next

End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 7

sebastien.forman
Advocate
Advocate

thanks again bradeneurope
fortunately there are people like you to help beginners like me

I wish you a nice day.

 

Sébastien

0 Likes
Message 6 of 7

bradeneuropeArthur
Mentor
Mentor

Did it solve the issue?

Your thanks are appreciated very much.

 

 Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 7

sebastien.forman
Advocate
Advocate

yes that works perfectly XD

0 Likes