run word mail merge from excel

mohamed ali abdelgawad

Board Regular
Joined
Nov 18, 2016
Messages
71
Office Version
  1. 365
Platform
  1. Windows
hi all
i have sheet witch contain data and i fill data on it then it's calculate , finally i close it and go to word document witch already have letter mail merge , then i print some of it , maybe record #1 , maybe from record 1 to 50.


i want to use macro to run it from excel to
1.run mail merge directly
2.and give me chaise from record : to record.
3.and open it as pdf file.


i searched a lot and find many macros but no one worked with me
so please help me
sorry if my English not good :)
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
go into word,
start recording a macro,
run your mail merge
stop recording,
alt-F11 (vbe)
get the code created in a module, copy all code

back in excel,
paste the code,in a module, in the section below that takes control of Word...


Code:
                    '*****  YOU MUST HAVE :  MS WORD xx.x OBJECT LIBRARY  checked in VBE menu, tools, references.  *****


sub Macro()
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")


With objWord
    .Visible = True


    Set doc = .Documents.Add
 
    'ADD YOUR CODE HERE


    'doc.SaveAs CurrentProject.Path & "\TestDoc.doc"
End With
end sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top