Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving a Word File from Mailmerge with Data Base Field Name as the File Name
    primarykey
    data
    text
    <p>I would like to able to save the active file in Word 2010 MailMerge, with its file name derived from the database field "First_Name" and from the database Field "Last_Name" into a subfolder that is a hardcoded subfolder. </p> <p>I receive an error that the <code>"requested member of the collection does not exist"</code>. </p> <p>I know this error occurs when you try to access an object that does not exist. The data base field is First_Name, and I have tried First Name as well in case the code was searching for the Address Field of First Name, which has been paired with the Data Base Field of First_Name. Here is what I have tried:</p> <pre><code>Sub SavingIndividuallyByCustomerName() Dim firstname As String Dim lastname As String firstname = ActiveDocument.FormFields("First_Name").Result lastname = ActiveDocument.FormFields("Last_Name").Result 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 ChangeFileOpenDirectory "C:\folder\subfolder\subsubfolder\" ActiveDocument.SaveAs2 FileName:= _ "C:\folder\subfolder\subsubfolder\" &amp; firstname &amp; lastname &amp; ".docx" End Sub </code></pre> <p>When I hardcoded the name with</p> <pre><code>firstname = "John" lastname = "Doe" </code></pre> <p>I had no other errors and the active file saved.</p> <p>I also attempted to use without success:</p> <pre><code>Dim firstname As Field Dim lastname As Field </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload