Grab view title, place it into a prompted entry, per each sheet allowing the prompt entry to be edited if necessary

Grab view title, place it into a prompted entry, per each sheet allowing the prompt entry to be edited if necessary

G.Binl
Advocate Advocate
1,661 Views
15 Replies
Message 1 of 16

Grab view title, place it into a prompted entry, per each sheet allowing the prompt entry to be edited if necessary

G.Binl
Advocate
Advocate

Hello all ,

Hope you are well

I’m looking to populate the Prompted Entry with the title of the assemble of the first view on the sheet with iLogic.

We have multiple sheets and multiple assemblies and we want the 1st view on the sheet with that name.

But still allow it to be a prompted Entry to be edited if necessary.

I have been able to pull the drawing view name and place it into the tree sheet title ( see below Red underline) but cant make the leap to the prompted entry.

The underlined   125 – Post UV stage QE5.1 sample,  would be an example of the name that comes from the 1st drawing view on that sheet.

any help would be great.

Repalce-1.PNG 

GarrettBingle_1-1638885222842.png

Here is the code for naming the sheets I'm a novice at best with coding sitting on the shoulders of giants.

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Dim oDrawingView As DrawingView
Dim SheetNumber As String
'Dim SN = Properties.Value("Sheet Properties", "Sheet Number")'

'Iterate through sheets
i=1
For Each oSheet In oDoc.Sheets
'Grab the first drawing view on the sheet
oDrawingView = oSheet.DrawingViews(1)
SheetNumber = Mid(oSheet.Name, InStr(1, oSheet.Name, ":") + 1)

'Grab the model of the first drawing view
oModel = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument

'Assign the sheet name based off of the file name, with the path and extension removed
oSheet.Name = "Sheet - " & Sheetnumber & " " & System.IO.Path.GetFileNameWithoutExtension(oModel.FullFileName)
Next

End Sub

 

 

0 Likes
Accepted solutions (1)
1,662 Views
15 Replies
Replies (15)
Message 2 of 16

WCrihfield
Mentor
Mentor

Hi @G.Binl.  That is certainly a custom and complicated task to automate, but I think I may have an iLogic rule for you to try that may handle that task for you.  I tried to include plenty of comments throughout the code to help guide you about what is going on, so the code looks longer than it really is.

Here is the rule's code:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule to work. Exiting.", vbCritical, "iLogic")
	Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
'record originally active sheet (so we can restore it to active at end)
oOrigActiveSheet = oDDoc.ActiveSheet
'loop through all sheets
For Each oSheet As Sheet In oDDoc.Sheets
	oSheet.Activate
	'if no views, then skip to next sheet
	If oSheet.DrawingViews.Count = 0 Then Continue For
	'get first view
	oView = oSheet.DrawingViews.Item(1)
	'if no 'Model' (like Draft View) this will fail
	Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
	oFileName = System.IO.Path.GetFileNameWithoutExtension(oModel.FullFileName)
	'if no title block, then skip to next sheet
	If oSheet.TitleBlock Is Nothing Then Continue For
	'now get the TitleBlock
	oTB = oSheet.TitleBlock
	'now find the TextBox within it's definition that contains the right Prompted Entry
	Dim oTBDefSketch As DrawingSketch
	oTB.Definition.Edit(oTBDefSketch)
	oTBoxes = oTBDefSketch.TextBoxes
	'create variable to hold the TextBox we are looking for
	Dim oPromptTBox As Inventor.TextBox
	'loop through all TextBoxes
	For Each oTBox As Inventor.TextBox In oTBoxes
		'check within FormattedText for Prompted Entry code (XML)
		oFText = oTBox.FormattedText
		If oFText.Contains("<Prompt>05. Drawing sheet title</Prompt>") Then
			'we have found your TextBox used for Prompted Entry containing the text in your image
			oPromptTBox = oTBox
			Exit For 'get out of TextBoxes loop
		End If
	Next 'oTBox
	oTB.Definition.ExitEdit(False)
	'make sure we found the TextBox we were looking for, before trying to specify it
	If oPromptTBox IsNot Nothing Then
		'set the first view's model's file name as value of Prompted Entry in Title Block
		oTB.SetPromptResultText(oPromptTBox, oFileName)
	End If
Next 'oSheet
're-activate the sheet that was active when the rule started
oOrigActiveSheet.Activate
'just a simple message letting user know all is done
MsgBox("Finished processing all sheets.", vbInformation, "iLogic")

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 16

G.Binl
Advocate
Advocate

Wow Thanks @WCrihfield.

I tried the code and got,

 

Type mismatch. (Exception form HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

 

I Played around with it for a bit to see if I could brake it down to to find this error. but I think I'm better at reading  cuneiform text :). 

0 Likes
Message 4 of 16

WCrihfield
Mentor
Mentor

Well...that error message doesn't tell me very much, and it doesn't tell me which line of code the error happened at, so we will need to do some debugging to figure it out.  I could not test the code myself before posting, because I don't have your drawing with those prompted entries in it to test on.  Since you're not that familiar with iLogic yet, the simplest and oldest technique I can think of that you could try is the following.  With this rule open in your iLogic rule editor dialog, after each un-commented line of code, create a new line for some new code, then enter the following code:

MsgBox(1)

Then the next time (under the next line of code) enter:

MsgBox(2)

...and so on...increasing the number within () each time by 1 (or like 1.1, 1.2...2.1, 2.2 etc.)

Then, when you run the rule, you will see that series of little messages pop-up, until it gets to the point in the code where the error happens.  Pay close attention to the last number you see in a pop-up message just before the error happens.  Then when we open that rule back up in the iLogic rule editor dialog, we can scroll to where that numbered message is, and know that the next line of code after that is most likely where the error is being thrown.

 

Once we know specifically where the error is (what line of code), we have a better chance of being able to fix it.  Then we study that line of code to see what it is doing, and what variables may be involved, and devise a plan to either fix the code, or work around it if it is unavoidable with something like a Try...Catch...End Try block of code, if needed.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 16

G.Binl
Advocate
Advocate

@WCrihfield 

Thanks I will dig into it as soon as I finish up my current task list I appreciate the help!

0 Likes
Message 6 of 16

G.Binl
Advocate
Advocate

@WCrihfield 

That debug system works great. 

so it looks like it between msgbox(6 and 7)

 

	If oSheet.TitleBlock Is Nothing Then Continue For
	'now get the TitleBlock
	oTB = oSheet.TitleBlock
	'now find the TextBox within it's definition that contains the right Prompted Entry
			MsgBox(5)
	Dim oTBDefSketch As DrawingSketch
			MsgBox(6)
	oTB.Definition.Edit(oTBDefSketch)
			MsgBox(7)
	oTBoxes = oTBDefSketch.TextBoxes
			
	'create variable to hold the TextBox we are looking for
	Dim oPromptTBox As Inventor.TextBox
	'loop through all TextBoxes
			
	For Each oTBox As Inventor.TextBox In oTBoxes
		'check within FormattedText for Prompted Entry code (XML)
		oFText = oTBox.FormattedText
		If oFText.Contains("<Prompt>05. Drawing sheet title</Prompt>") Then
			'we have found your TextBox used for Prompted Entry containing the text in your image
			oPromptTBox = oTBox
			Exit For 'get out of TextBoxes loop
		End If
	Next 'oTBox

  

0 Likes
Message 7 of 16

WCrihfield
Mentor
Mentor

OK.  That line of code is actually doing 2 things.  It is creating a copy of the sketch that was used in the title block definition, and it is entering into the Edit Mode of that copied sketch.  Here is a link to the online help page for it.  In that situation, we must create the DrawingSketch type variable ahead of time (with no value assigned to it yet), then supply that variable in that line of code, then that line of code sets the value of that variable as the copied sketch.  However, I believe we may be able to avoid using this line of code, and its counterpart line later in the code that exits out of this Edit Mode without saving, since we don't technically need to edit the sketch, just find a text box within it.  I will modify the code to avoid using those 2 lines of code, then just get the sketch directly instead.

Try this:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule to work. Exiting.", vbCritical, "iLogic")
	Exit Sub
End If
MsgBox(1)
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
'record originally active sheet (so we can restore it to active at end)
oOrigActiveSheet = oDDoc.ActiveSheet
'loop through all sheets
For Each oSheet As Sheet In oDDoc.Sheets
	oSheet.Activate
	'if no views, then skip to next sheet
	If oSheet.DrawingViews.Count = 0 Then Continue For
	'get first view
	oView = oSheet.DrawingViews.Item(1)
	'if no 'Model' (like Draft View) this will fail
	Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
	oFileName = System.IO.Path.GetFileNameWithoutExtension(oModel.FullFileName)
	'if no title block, then skip to next sheet
	If oSheet.TitleBlock Is Nothing Then Continue For
	'now get the TitleBlock
	oTB = oSheet.TitleBlock
	'get the sketch within the title block's definition, so we can search within it
	oTBDefSketch = oTB.Definition.Sketch
	'focus on its TextBoxes
	oTBoxes = oTBDefSketch.TextBoxes
	'create variable to hold the TextBox we are looking for
	Dim oPromptTBox As Inventor.TextBox
	'loop through all TextBoxes
	For Each oTBox As Inventor.TextBox In oTBoxes
		'check within FormattedText for Prompted Entry code (XML)
		oFText = oTBox.FormattedText
		If oFText.Contains("<Prompt>05. Drawing sheet title</Prompt>") Then
			'we have found your TextBox used for Prompted Entry containing the text in your image
			oPromptTBox = oTBox
			Exit For 'get out of TextBoxes loop
		End If
	Next 'oTBox
	'make sure we found the TextBox we were looking for, before trying to specify it
	If oPromptTBox IsNot Nothing Then
		'set the first view's model's file name as value of Prompted Entry in Title Block
		oTB.SetPromptResultText(oPromptTBox, oFileName)
	End If
Next 'oSheet
're-activate the sheet that was active when the rule started
oOrigActiveSheet.Activate
'just a simple message letting user know all is done
MsgBox("Finished processing all sheets.", vbInformation, "iLogic")

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 8 of 16

G.Binl
Advocate
Advocate

@WCrihfield Thx for the update. 

I Played around with it. It Cycles thru the sheets but writes nothing to the Titleblock. 

I believe this happens in this area of the code.  I tried to adjust this area of the coed but with no luck I will continue to test and decipher what you have sent me. 

 

 

MsgBox(1)
	'make sure we found the TextBox we were looking for, before trying to specify it
	If oPromptTBox IsNot Nothing Then
		'set the first view's model's file name as value of Prompted Entry in Title Block
		oTB.SetPromptResultText(oPromptTBox, oView)
		
	End If
	MsgBox(2)

 

0 Likes
Message 9 of 16

WCrihfield
Mentor
Mentor

The most likely place in that code for it to fail would be where it is checking the contents of the TextBox.FormattedText, because that part can be pretty complicated to predict.  Here is a technique you can use to find out what exactly that text box's formatted text really contains, so we know more specifically what to search for.  You would need to manually enter the edit mode of your title block so that you can select that specific text block first.  Then run this iLogic rule to get/show the contents of its formatted text.  When you use a MsgBox or MessageBox.Show, the text won't be selectable, but when you use an InputBox, then put the text in the 'DefaultResponse' position, it will be selectable (and copy/paste 'able).  You can use similar code to check the contents of things like leader notes on your drawing, when changed appropriately.

oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchTextBoxFilter, "Select a sketch text box.")
If oObj Is Nothing Then Exit Sub
If TypeOf oObj Is Inventor.TextBox Then
	Dim oTBox As Inventor.TextBox = oObj
	oFText = oTBox.FormattedText
	MsgBox(oFText, , "FormattedText Contents")
	'this will be 'selectable' because it will be in the input field
	a = InputBox("","FormattedText Contents", oFText)
End If

Once you can select the contents of that text box's formatted text, then we can update that line of code that is checking its contents accordingly.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 10 of 16

G.Binl
Advocate
Advocate

@WCrihfield 

tested the last code you sent and nothing happened after selecting the textbox and it go me to thinking that maybe I miss led the question at hand. 

for each sheet I have to go into this portion of the tree and edit both red arrows.

The Red arrows is the only thing that can be changed  at this window everything in blue comes from iProperties Custom

want to make sure were talking apples to apples because this it over my head at this point but learning.

GarrettBingle_4-1638987284352.png

 

Repalce-7.PNG

Repalce-5.PNGRepalce-6.PNG

 

 

 

0 Likes
Message 11 of 16

WCrihfield
Mentor
Mentor
Accepted solution

OK.  As I said, this can be a pretty complicated task to automate, especially blindly/remotely without test files.  We will try this a slightly different way this time.  Instead of checking the contents of the textbox's FormattedText to find the specific ones, we will try to find them by the 'default value' they are currently showing.  This is a bit simpler, but may not work if those prompted entries already contain a 'non-default values'.  This code simply loops through every TextBox in the title block's definition sketch, then uses the TitleBlock.GetResultText method to get its currently displayed value.  Then checks to make sure it's not empty.  Then compares that value to the 'default value' we are expecting to find, in an attempt to find/identify the right one.  Once it finds a match, it then uses the TitleBlock.SetPromptResultText method to set its new value.

Here is the new iLogic rule code you can try:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule to work. Exiting.", vbCritical, "iLogic")
	Exit Sub
End If
MsgBox(1)
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
'record originally active sheet (so we can restore it to active at end)
oOrigActiveSheet = oDDoc.ActiveSheet
'loop through all sheets
For Each oSheet As Sheet In oDDoc.Sheets
	oSheet.Activate
	'if no views, then skip to next sheet
	If oSheet.DrawingViews.Count = 0 Then Continue For
	'get first view
	oView = oSheet.DrawingViews.Item(1)
	'oScale = oView.Scale 'a Double
	oScale = oView.ScaleString
	'if no 'Model' (like Draft View) this will fail
	Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
	oFileName = System.IO.Path.GetFileNameWithoutExtension(oModel.FullFileName)
	'if no title block, then skip to next sheet
	If oSheet.TitleBlock Is Nothing Then Continue For
	'now get the TitleBlock
	oTB = oSheet.TitleBlock
	'get the sketch within the title block's definition, so we can search within it
	oTBDefSketch = oTB.Definition.Sketch
	'focus on its TextBoxes
	oTBoxes = oTBDefSketch.TextBoxes
	
	For Each oTBox As Inventor.TextBox In oTBoxes
		Dim oVal As String
		Try
			oVal = oTB.GetResultText(oTBox)
		Catch oEx As Exception
				MsgBox("Error when using 'GetResultText' method." & vbCrLf & _
				oEx.Message & vbCrLf & oEx.StackTrace, vbExclamation, "iLogic")
				Continue For
		End Try
		If String.IsNullOrEmpty(oVal) Then Continue For
		If oVal = "xxxxxxxxxxxxxxxxxxxxxxxxxx" Then
			'found the TextBox for the Prompted Entry labeled "05. Drawing sheet title"
			Try
				oTB.SetPromptResultText(oTBox, oFileName)
			Catch oEx As Exception
				MsgBox("Found TextBox, but error setting new value." & vbCrLf & _
				oEx.Message & vbCrLf & oEx.StackTrace, vbExclamation, "iLogic")
			End Try
		ElseIf oVal = "NTS" Then
			'found the TextBox for the Prompted Entry labeled "15. Scale"
			Try
				oTB.SetPromptResultText(oTBox, oScale)
			Catch oEx As Exception
				MsgBox("Found TextBox, but error setting new value." & vbCrLf & _
				oEx.Message & vbCrLf & oEx.StackTrace, vbExclamation, "iLogic")
			End Try
		End If
	Next 'oTBox
	
Next 'oSheet

're-activate the sheet that was active when the rule started
oOrigActiveSheet.Activate
'just a simple message letting user know all is done
MsgBox("Finished processing all sheets.", vbInformation, "iLogic")

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 12 of 16

G.Binl
Advocate
Advocate

@WCrihfield .

This is great, ok we are getting closer Wait you are getting closer this works as long as the prompts contain 

the set values.

If oVal ="xxxxxxxxxxxxxxxxxxxxxxxxxx"

Elseif oVal = "NTS"

see diagram A.

I Tried to figure out a way to do this if the prompt is empty or has text already in it. 

Itried this code.

If String.IsNullOrEmpty(oVal) Then oVal = "xxxxxxxxxxxxxxxxxxxxxxxxxx" Else Continue For
		If oVal <> "xxxxxxxxxxxxxxxxxxxxxxxxxx" Then oVal = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
		If oVal = "xxxxxxxxxxxxxxxxxxxxxxxxxx" 

and it seemed to work I know your eyes are hurting.

I thought I might be able to break the code into 2 rules if it worked. 1. for title and  2. for the scale.

but could not figure out how to differentiate the 2 prompts with this code....

So my another question is can I use simple code like Right, Len & left on the variable  oVal?

I would like to remove the leading number in this case the 101.9 -,   See diagram B

I have some code that I have done this with but haven't figured out how to do it with the current code.

A set value works fine there maybe a few sheets that I will manually change better then 75 sheets of change.

BTW this has been a very eye opening experience for me with great appreciation. 

Repalce-2.PNGGarrettBingle_2-1639077197445.png

 

 

 

0 Likes
Message 13 of 16

WCrihfield
Mentor
Mentor

It could be split into two rules, but that would seem very inefficient and most likely unnecessary.  I'm confident we can find a way to work around this little problem, if we think about it a bit.  One thought would be to display the contents of those text boxes to you, then have you confirm, one way or another.  Like looping through them 1 time just to record their values to a list, then display that list in an InputListBox to you, then when you choose one, loop back through them again and get that corresponding text box to process a certain way.  There are lots of little ideas like that.  I'll have to look at it again tomorrow though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 14 of 16

G.Binl
Advocate
Advocate
Thx I will be pecking at here and there
0 Likes
Message 15 of 16

G.Binl
Advocate
Advocate

Hello @WCrihfield 

Hope the New year will treat you well. I have been Pecking at this issue and still working on writing to the Prompted entry. still has me boggled. but good new is I figured out how to chop the " 109 - " off the title

GarrettBingle_0-1641225283625.png

so making progress.  Just wanted to update you. 

0 Likes
Message 16 of 16

G.Binl
Advocate
Advocate

Hello @WCrihfield 

So I have gotten to a point where I have 2 rules they are not elegant by no means but work.

Rule 1

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule to work. Exiting.", vbCritical, "iLogic")
	Exit Sub
End If
MsgBox(1)
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
'record originally active sheet (so we can restore it to active at end)
oOrigActiveSheet = oDDoc.ActiveSheet
'loop through all sheets

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
	' This works adds NTS and clears 05. 
Dim oTB As Inventor.TitleBlock = oDoc.ActiveSheet.TitleBlock
'Exit if Active Sheet does not have a Title Block
If oTB Is Nothing Then Exit Sub

Dim oTextBox As TextBox
Dim oTextBoxes As TextBoxes = oTB.Definition.Sketch.TextBoxes

For Each oSheet As Sheet In oDDoc.Sheets
	oSheet.Activate
 For Each oTextBox In oTextBoxes
	'Pull existing value from prompt entry.
	sData = oTB.GetResultText(oTextBox)
	If oTextBox.Text = "SHT_TTL_L1" Then '"SHT_TTL_L1"
		'Prompt for new value
		SHT_TTL_L1 = InputBox(oTextBox.Text, oTextBox.Text, sData)
		'Reuse existing value if InputBox was canceled
		'NOTE: THIS WILL NOT ALLOW YOU TO ENTER DELETE AN EXISTING VALUE.
		If SHT_TTL_L1 = "" Then SHT_TTL_L1 = sData
			
		' i dont think this Else if is doing anything at all
	ElseIf oTextBox.Text = "ugh" Then '"SHT_TTL_L2" 
		SHT_TTL_L2 = InputBox("lol", "kok", "bob") ' oTextBox.Text,oTextBox.Text,sData
		If SHT_TTL_L2 = "NTS" Then SHT_TTL_L2 = "NTSs"
		
	End If
Next
'Use existing Title Block and push prompted Entries
ActiveSheet.SetTitleBlock(oTB.Name, "xx", "NTS")'SHT_TTL_L2
	
Next 'oSheet
're-activate the sheet that was active when the rule started
oOrigActiveSheet.Activate
'just a simple message letting user know all is done
MsgBox("Finished processing all sheets.", vbInformation, "iLogic")

 results, Perfect

Repalce-3.PNG

Rule 2. again sorry for the butchering of your code.

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule to work. Exiting.", vbCritical, "iLogic")
	Exit Sub
End If
MsgBox(1)
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
'record originally active sheet (so we can restore it to active at end)
oOrigActiveSheet = oDDoc.ActiveSheet

'Count Charaters String of 1st drawing view
Dim Countme As String

'loop through all sheets
For Each oSheet As Sheet In oDDoc.Sheets
	oSheet.Activate
	'if no views, then skip to next sheet
	If oSheet.DrawingViews.Count = 0 Then Continue For
	'get first view
	oView = oSheet.DrawingViews.Item(1)
	'oScale = oView.Scale 'a Double
	oScale = oView.ScaleString
	'if no 'Model' (like Draft View) this will fail
	Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
	Countme = (Len((System.IO.Path.GetFileNameWithoutExtension(oModel.FullFileName))) -6)
	oFileName =  Right(System.IO.Path.GetFileNameWithoutExtension(oModel.FullFileName),(Countme))
	'if no title block, then skip to next sheet
	If oSheet.TitleBlock Is Nothing Then Continue For
	'now get the TitleBlock
	oTB = oSheet.TitleBlock
	'get the sketch within the title block's definition, so we can search within it
	oTBDefSketch = oTB.Definition.Sketch
	'focus on its TextBoxes
	oTBoxes = oTBDefSketch.TextBoxes
	
	For Each oTBox As Inventor.TextBox In oTBoxes
		Dim oVal As String
		Try
			oVal = oTB.GetResultText(oTBox)
		Catch oEx As Exception
				MsgBox("Error when using 'GetResultText' method." & vbCrLf & _
				oEx.Message & vbCrLf & oEx.StackTrace, vbExclamation, "iLogic")
				Continue For
		End Try
		If String.IsNullOrEmpty(oVal) Then Continue For
		If oVal = "xx" Then
			'found the TextBox for the Prompted Entry labeled "05. Drawing sheet title"
			Try
				oTB.SetPromptResultText(oTBox, oFileName)
			Catch oEx As Exception
				MsgBox("Found TextBox, but error setting new value." & vbCrLf & _
				oEx.Message & vbCrLf & oEx.StackTrace, vbExclamation, "iLogic")
			End Try
		'ElseIf oVal = "NTS" Then
			'found the TextBox for the Prompted Entry labeled "15. Scale"
			'Try
				'oTB.SetPromptResultText(oTBox, oScale)
			'Catch oEx As Exception
				'MsgBox("Found TextBox, but error setting new value." & vbCrLf & _
				'oEx.Message & vbCrLf & oEx.StackTrace, vbExclamation, "iLogic")
			'End Try
		End If
	Next 'oTBox
	
Next 'oSheet

're-activate the sheet that was active when the rule started
oOrigActiveSheet.Activate
'just a simple message letting user know all is done
MsgBox("Finished processing all sheets.", vbInformation, "iLogic")

Results in 

Repalce-4.PNG

Perfect.

Some point I will merge the 2 Rules but for now it will work for me.

Thank you for all your help on this matter I would have never been able to come up with anything with out your help iLogic is a craft that my skill sets are far from.

Hope the New Year Treats you well.

Garrett