Hi All,
I'm trying to have a variable for Column D and Row X however I'm unsure of how to go about this. As the value in Column D Row X will be based on each row it can be either ABC or XYZ.
Dependent on the value in each column the mail merge will use a different document for each rows mail merge.
At the moment I have the below but unsure how to get it as dynamic :/ !
Any help is appreciated - thanks
I'm trying to have a variable for Column D and Row X however I'm unsure of how to go about this. As the value in Column D Row X will be based on each row it can be either ABC or XYZ.
Dependent on the value in each column the mail merge will use a different document for each rows mail merge.
At the moment I have the below but unsure how to get it as dynamic :/ !
VBA Code:
'Mailmerge for Sheet1
Dim wdc
Dim xc
Dim ContractType As Range
Dim RowTarget1 As Long
Dim X as integer
Dim Worksheet As Worksheet
Set Worksheet= ActiveSheet
Set ContractType = ActiveSheet.Cells(x, 4)
X = 2
Set wdc = CreateObject("word.application")
wdc.Application.documents.Open "\Templates\" & ContractType & ".docm"
wdc.Application.Visible = False
Application.ScreenUpdating = False
wdc.Application.Run "Template1"
Set wdc = Nothing
MsgBox ("Mail Merge Completed")
Application.ScreenUpdating = True