View Single Post
 
Old 05-23-2023, 01:40 AM
soroush.kalantari soroush.kalantari is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Jun 2021
Posts: 124
soroush.kalantari is on a distinguished road
Default How to to automatically update Word links with Mail Merge, when opening Word file from Excel?

I have used the “Mail Merge” to link excel cells to word document. Whenever I open the word document with Mail Merge, a box is opened and when I say “yes”, all the links are updated. I have written following macro in the Excel file to open word document from Excel and do some modifications on it.
My problem is that when I open the word document from Excel , this box is not displayed and the Excel links are not updated in the Word document. Can you guide me how can I modify this macro to automatically update Word links when opening the Word document?

Sub OpenWord()


Dim oAPP As Object

Set oAPP = CreateObject(Class:="Word.Application")

oAPP.Visible = True

oAPP.Documents.Open Filename:="D:\kalantari\valuation\contract.templat e\word\mail02.docm"
oAPP.Visible = True

oAPP.Run "macro4"

oAPP.Run "unlinkheader"

End Sub
Attached Images
File Type: png sqr.comment.PNG (8.6 KB, 13 views)

Last edited by soroush.kalantari; 05-23-2023 at 05:18 AM.
Reply With Quote