Try this:
(You can get rid of the beginning portion of the code if you already have your own code for it.)
Dim oADoc As AssemblyDocument = ThisAssembly.Document
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oDType As DocumentTypeEnum = DocumentTypeEnum.kDrawingDocumentObject
Dim oDTFileName As String = ThisApplication.FileManager.GetTemplateFile(oDType)
Dim oDDoc As DrawingDocument = ThisApplication.Documents.Add(oDType, oDTFileName, True)
Dim oSheet As Sheet = oDDoc.ActiveSheet
Dim oTB As TitleBlock = oSheet.TitleBlock
Dim oTBD As TitleBlockDefinition = oTB.Definition
Dim oSketch As DrawingSketch
oTBD.Edit(oSketch)
Dim oTBox, oLTBox, oSTBox As Inventor.TextBox
For Each oTBox In oSketch.TextBoxes
If oTBox.FormattedText.Contains("LongDesc") Then
oLTBox = oTBox
ElseIf oTBox.FormattedText.Contains("ShortDesc") Then
oSTBox = oTBox
End If
Next
oTBD.ExitEdit(True)
Dim oNewLongDesc As String = "New Long Desc"
Dim oNewShortDesc As String = "New Short Desc"
oTB.SetPromptResultText(oLTextBox,oNewLongDesc)
oTB.SetPromptResultText(oSTextBox,oNewShortDesc)
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE" 👍.
Also, when you have time, please review & vote for these 'Ideas' I'd like to get implemented.
- Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
- Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
- Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
- Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
- Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
- SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
- Create DocumentSubTypeEnum Click Here
- Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum Click Here
Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield

(Not an Autodesk Employee)