+ Reply to Thread
Results 1 to 2 of 2

VBA Script to Find and Replace in Word Template replaces with blank values

  1. #1
    Registered User
    Join Date
    12-06-2019
    Location
    Gloucestershire
    MS-Off Ver
    Office 365 - Excel
    Posts
    1

    VBA Script to Find and Replace in Word Template replaces with blank values

    Hi, I have looked around and tried a range of things with this code. On a button click I am looking to open a Word Template, Find and Replace, Export as PDF, and then Email the PDF. This is all working apart from the find and replace function which opens the Template looks at the 2nd row of DeliveryDetails to get the tag names i.e. !!Customer!! finds that tag in the Template and replaces it with nothing. I want it to replace each tag with the value in Row 3, and repeat this for as many rows as are present.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    16,351

    Re: VBA Script to Find and Replace in Word Template replaces with blank values

    I think you are trying to reinvent Mail Merge, a built-in feature of Word where document fields can be replaced by values in an Excel file. The typical use is to generate form letters, which is what it looks like you are doing. I would suggest looking up documentation for that first before you spend more effort on a custom solution. You could still have a macro to email the file.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find/Replace with script
    By forestavekids in forum Excel General
    Replies: 11
    Last Post: 11-29-2016, 10:09 PM
  2. [SOLVED] Find and Replace - quantum of replaces
    By Odeen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2013, 05:17 AM
  3. Find and replace script
    By grandmastr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2010, 12:59 PM
  4. Find and replace script
    By mambotech in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2009, 05:07 AM
  5. Mass Find & Replace Script?
    By TyneeTom in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-24-2009, 03:41 AM
  6. Find and replace script / macro?
    By luu980 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-09-2009, 01:59 PM
  7. VBA Script. Find & Replace.
    By denis.samoilov in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2008, 11:14 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1