Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Folks,
Trying to extract prompted entry/field text from an old border to custom iproperties. Using the code from this thread:
Works very well, I've got most the data extracted already, however I'm having trouble getting the revision table information, as the field text names are not unique. I'd like each occurrence of the following entries to be written to a unique custom iProperty. For example, first occurrence of "ISSUE" -> iProperties.Value("Custom", "ISSUE_01") etc. Right now it will get the revision 10 line information, I guess that's the first instance of the defText it can find.
Any help would be much appreciated!
'Read Field Text from Border in Active Sheet
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet
Dim oBD1 As Border
oBD1 = oSheet.Border
Dim BorderDef As BorderDefinition
BorderDef = oBD1.Definition
Dim oPrompt1 As TextBox
Dim oPrompt2 As TextBox
Dim oPrompt3 As TextBox
Dim oPrompt4 As TextBox
Dim oPrompt5 As TextBox
Dim oPrompt6 As TextBox
Dim oPrompt7 As TextBox
Dim oPrompt8 As TextBox
'make sure you declare all your prompts
' Find the Prompted Entry in the Border
For Each defText As TextBox In BorderDef.Sketch.TextBoxes
On Error Resume Next
If defText.Text = "ISSUE" Then
oPrompt1 = defText
ElseIf defText.Text = "DRF No." Then
oPrompt2 = defText
ElseIf defText.Text = "MODIFICATION" Then
oPrompt3 = defText
ElseIf defText.Text = "DRAWN BY" Then
oPrompt4 = defText
ElseIf defText.Text = "DATE" Then
oPrompt5 = defText
ElseIf defText.Text = "CHKD" Then
oPrompt6 = defText
ElseIf defText.Text = "APPROVED BY" Then
oPrompt7 = defText
ElseIf defText.Text = "MFG APP BY" Then
oPrompt8 = defText
End If
Next
'write prompted entry to iprop
Dim T1 As String
Dim T2 As String
Dim T3 As String
Dim T4 As String
Dim T5 As String
Dim T6 As String
Dim T7 As String
Dim T8 As String
'Declare all your unique strings
T1 = oBD1.GetResultText(oPrompt1)
T2 = oBD1.GetResultText(oPrompt2)
T3 = oBD1.GetResultText(oPrompt3)
T4 = oBD1.GetResultText(oPrompt4)
T5 = oBD1.GetResultText(oPrompt5)
T6 = oBD1.GetResultText(oPrompt6)
T7 = oBD1.GetResultText(oPrompt7)
T8 = oBD1.GetResultText(oPrompt8)
'set all unique strings to unique prompts
iProperties.Value("Custom", "ISSUE") = T1
iProperties.Value("Custom", "DRF No.") = T2
iProperties.Value("Custom", "MODIFICATION") = T3
iProperties.Value("Custom", "DRAWN BY") = T4
iProperties.Value("Custom", "DATE") = T5
iProperties.Value("Custom", "CHKD") = T6
iProperties.Value("Custom", "APPROVED BY") = T7
iProperties.Value("Custom", "MFG APP BY") = T8
'Set all iProperties To unique strings
Solved! Go to Solution.