Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    extra spaces in results of VBA find & replace (VBA / Word XP / Windows XP

    I'm trying to code a find & replace that will replace all instances of [customer contact] in my document with specific customer information contained in variables in my code. My problem is that all lines after the first one are appearing with an extra space at the beginning. Here's my code:

    ' the following code builds a string (strFullContactInfo) containing the complete contact information
    With gCustInfo
    strFullContactInfo = .ContactFirstName & " " & .ContactLastName & vbCrLf & .CustomerCompany & vbCrLf & .ContactAddress
    End With

    ' the following code does the find & replace
    With ActiveDocument
    .Content.Find.Execute "[customer contact]", False, True, False, False, False, True, wdFindContinue, False, strFullContactInfo, wdReplaceAll, False, False, False, False
    End With

    Can anyone help me remove these extra spaces.

    thanks!

    Taibe

  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

    Re: extra spaces in results of VBA find & replace (VBA / Word XP / Window

    Please post your suggestions in this duplicate thread on the Word board.

Posting Permissions

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