Message 1 of 3
Looping through sheets to change sheet not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anyone tell me why this rewrites the values on page 1 twice, moves to page 2, but does nothing?
'Set new Drawing Number Dim oMTRNum As String Dim oMTRInt As Integer For Each oSheet In oDoc.Sheets oSheet.Activate For Each oTextBox In oTB.Definition.Sketch.TextBoxes If GetPromptField(oTextBox.FormattedText) = "DRAWING_NO" Then MsgBox "title written" Call oTB.SetPromptResultText(oTextBox, strDN) Exit For End If Next 'reset revision to 0 For Each oTextBox In oTB.Definition.Sketch.TextBoxes If GetPromptField(oTextBox.FormattedText) = "REV_NO" Then MsgBox "Rev written" Call oTB.SetPromptResultText(oTextBox, "1") Exit For End If Next next
I have a feeling it has to do with referring to activesheet. But i'm unsure how to reference the oTB.Definition.Sketch.TextBoxes portion for current sheet. I know that oDoc.Sheets(1).TitleBlock.Definition.Sketch.TextBoxes address just sheet 1...just not sure how to make it deal with the current sheet.
Thanks