I'm working on the project I mentioned in my introduction http://forum.codecal...ello-world.html
Using Visual Basic 6 and I'm a total newb so keep that in mind. Here is the code I'm having trouble with.
Dim sex As String sex = genderBox.Text If sex = "Female" Then oWord.Selection.Find.Execute(Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll) With oWord.Selection.Find .Text = "he" .Replacement.Text = "she" .Forward = True .Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With oWord.Selection.Find.Execute(Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll) With oWord.Selection.Find .Text = "male" .Replacement.Text = "female" .Forward = True .Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With oWord.Selection.Find.Execute(Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll) *was missing this line End If
The first instance of find and replace is working fine (it replaces all instances of "he" with "she" in the document). However, the following instances are not working ("male" is not replaced with "female" in the document). If you can help me out I would really appreciate it. Thank you for your time.
Edited by Anavrin, 29 January 2012 - 01:32 AM.
Found the problem *Sorry*


Sign In
Create Account

Back to top









