Results 1 to 2 of 2
  1. #1
    New Lounger Bigshrimp60's Avatar
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Need some code to find and replace gender in a template

    Hi All

    I am a VBA newbie and I have created a template that has a userform with several variables. One variable that I want to add is a set of radio buttons to make the final document gender specific. Throughout the document there are many instances of He/She and His/Her and I want the user to select the Male or Female radio button and then have the code behind it go through the document and find and replace He/She or Him/Her with He, She, Him or Her. I don't know how to do that and could really use some help. Thanks.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    I suggest starting by recording a macro of running several global find-and-replace operations to handle the changes in the text. Then you can streamline that code and call it from your userform. Because the find-and-replace operations probably are irreversible you might not want to have it run immediately upon selecting a radio button, but wait until the user confirms the dialog (e.g., OK button, etc.), just in case they click the wrong one accidentally.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •