RP1America
Technical User
Hi, I am fairly new to VBA and even newer to dealing with Mail Merge in VBA.
The end result that I am looking for is to be able to have the user enter an input on a userform (PlanNumber) and from that, mail merge that record into the document from a .dbf file.
I am lost. I have scourred the web looking for something that I can digest, yet have come up empty. Any help would be greatly appreciated!
I recorded a macro while doing the merge manually and got the following, yet was hoping to see where it accepted my input to find the PlanNumber and that is not there.
Thank you in advance!
The end result that I am looking for is to be able to have the user enter an input on a userform (PlanNumber) and from that, mail merge that record into the document from a .dbf file.
I am lost. I have scourred the web looking for something that I can digest, yet have come up empty. Any help would be greatly appreciated!
I recorded a macro while doing the merge manually and got the following, yet was hoping to see where it accepted my input to find the PlanNumber and that is not there.
Thank you in advance!
Code:
Sub Merge1()
'
' Merge1 Macro
'
'
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
.LastRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
End With
.Execute Pause:=False
End With
Windows("Zero Dollar Contract ASA Terminations.dotm").Activate
End Sub