Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-09-2018, 01:43 PM
stevenel stevenel is offline Mailmerge Excel with a Master Word Template (via VBA) Windows 7 64bit Mailmerge Excel with a Master Word Template (via VBA) Office 2013
Novice
Mailmerge Excel with a Master Word Template (via VBA)
 
Join Date: Jul 2018
Posts: 26
stevenel is on a distinguished road
Default Mailmerge Excel with a Master Word Template (via VBA)

Hey guys,

I currently have two files. One is my excel with data in it. One is my word (which I call my master) where you can find all my mergefields. Instead of opening word every time, choosing the excel location then printing it out, I wanna code it via VBA. Here's my code:

Public Sub Print()

Set wDApp = CreateObject("Word.Application")

wDApp.Documents.Open (blablabla)
wDApp.Visible

With wdApp.MailMerge


.MainDocumentType = wdDirectory
.OpenDataSource_
Name:"blablabla2"_
LinkToSource=True, AddToRecentFiles, _
End With

End Sub

My first question is regarding blablabla2. How do I code it so VBA knows I want him to use the current workbook i am currently on (my workbook has only one worksheet). My second question is how do I make the code working? I know it doesn't end there and it crashes so any help would be appreciated

thank you very much in advance
Reply With Quote
 

Tags
mail merge, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mailmerge Excel with a Master Word Template (via VBA) Suppress blank lines in mailmerge of excel reports into word document beefcake2000 Mail Merge 1 11-10-2017 12:54 PM
Master template and subtemplate docs ab-os Word 1 05-02-2017 01:23 PM
Mailmerge Excel with a Master Word Template (via VBA) Template From MailMerge Document LouGibson Mail Merge 1 06-13-2016 03:14 PM
how to copy addresses in word document to excel/mailmerge list msnarayanan Mail Merge 4 10-17-2015 03:17 PM
Mailmerge Excel with a Master Word Template (via VBA) Excel, transfer data from Master Sheet to sub sheets, using key word from column anvqui Excel Programming 9 06-16-2015 01:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:50 AM.


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