Consulting

Results 1 to 4 of 4

Thread: Solved: IF statements and Word textboxes.

  1. #1
    VBAX Regular
    Joined
    Nov 2004
    Posts
    74
    Location

    Solved: IF statements and Word textboxes.

    I have a userform with some textboxes on it. I would like one of the textboxes to add some characters to the front of the text input BUT only if something is added.

    Therefore if the textbox is left blank and the user confirms the userform it will write nothing to the template.

    However if the textbox has ?Newk? entered in it, the output will be ?cc. Newk?

    Is this possible? I can only see it being possible with an IF statement in VBA.

    Please could someone enlighten me!

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Try something like this:

    [VBA]If Me.TextBox1.Text <> "" Then
    Selection.TypeText Text:="cc. " & Me.TextBox1.Text
    End If[/VBA]

  3. #3
    VBAX Regular
    Joined
    Nov 2004
    Posts
    74
    Location
    Thank you DRJ that works a treat.

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You're Welcome

    Take Care

Posting Permissions

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