Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 02-04-2019, 08:11 AM
Kenneth Hobson Kenneth Hobson is offline Start MailMerge for 3 different Word documents in Excel depending on value in column A Windows 10 Start MailMerge for 3 different Word documents in Excel depending on value in column A Office 2016
Advanced Beginner
 
Join Date: Jun 2018
Posts: 37
Kenneth Hobson is on a distinguished road
Default

You have to change the code to suit your needs. I had to make guesses.

Code:
 p = "c:\MyFiles\Word\sb\sb"
  dat = "c:\MyFiles\Excel\Dat\dat.xls"
  sql = "SELECT * FROM 'Sheet1$'"
  Set r = Range("A2", Cells(Rows.Count, "A").End(xlUp))
p is the path to your docx files with the first 2 letters of your docx filename at the end, sb.

Dat is the full path to your excel data file.

sql gets the data from all of sheet1 in your dat file.

r is the range A2 and down from the current sheet with the suffix docx filenames, 1,2,3, etc.

The code goes into a Module as does the MergeRun() code.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Start MailMerge for 3 different Word documents in Excel depending on value in column A Mailmerge Excel with a Master Word Template (via VBA) stevenel Excel Programming 8 08-14-2018 03:05 PM
Start MailMerge for 3 different Word documents in Excel depending on value in column A Rounding Up or Down depending on Start & End time richardst Excel 4 06-21-2016 06:03 PM
Marking specific cells depending on start and end time entered ellebb85 Excel Programming 0 01-17-2016 02:50 AM
Start MailMerge for 3 different Word documents in Excel depending on value in column A documents saved with double column revert to single column when re-opened danw Word 6 04-08-2015 06:24 AM
Merge Word documents using a mailmerge field Concertina Mail Merge 3 02-18-2013 04:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft