-
Visio VBA - Find and Replace from UserForm
I'm using Visio 2003 and have created a Userform with multiple text fields. I'd like the Submit button when clicked to Find a value throught all my diagrams and then replace that value with what was inputted by the User in the associated text field.
Any help would be much appreciated.
Here's what I tried and keep getting this error:
run time error 424'
object required
[VBA]
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[Promotion Name]"
.Replacement.Text = TextBox1.Value
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
[/VBA]
-
This works for some shapes, but not all areas
The last code was find and replace for MS word
[VBA]
Dim iDocumentCount As Integer
iDocumentCount = Documents.Count
Dim iPageCount As Integer
iPageCount = Documents(1).Pages.Count
Dim iCurrentPage As Integer
For iCurrentPage = 1 To iPageCount
iShapeCount = Documents(1).Pages(iCurrentPage).Shapes.Count
Dim iCurrentShape As Integer
For iCurrentShape = 1 To iShapeCount
Documents(1).Pages(iCurrentPage).Shapes(iCurrentShape).Text = Replace(Documents(1).Pages(iCurrentPage).Shapes(iCurrentShape).Text, "CHECK ME", TextBox1.Text)
Next
Next
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules