Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2017, 02:34 PM
pttsv pttsv is offline Use a the data from a mail merge field Windows 10 Use a the data from a mail merge field Office 2013
Novice
Use a the data from a mail merge field
 
Join Date: Dec 2017
Posts: 2
pttsv is on a distinguished road
Default

Code:
Sub Image_Folder()
'
'
'
'

ImageFolder = _
ActiveDocument.MailMerge.DataSource.DataFields("ImageFolder").Value

FL = Left(ImageFolder, 1)

FName = _
ActiveDocument.MailMerge.DataSource.DataFields("FName").Value

LName = _
ActiveDocument.MailMerge.DataSource.DataFields("LName").Value

File = LName & ", " & FName

NewPath = "Y:\OpenDentImages\" & FL & "\" & ImageFolder & "\"

Dim n As Integer
    Dim FilePath As String
    n = 0
    Do
        FilePath = "Y:\OpenDentImages\" & FL & "\" & ImageFolder & "\" & File & IIf(n = 0, "", n) & ".doc"
        n = n + 1
    Loop Until Dir(FilePath) = ""

ActiveDocument.SaveAs2 FilePath, FileFormat:=wdFormatPDF

ActiveDocument.SaveAs2 FilePath, FileFormat:=wdFormatDocumentDefault



End Sub
this is my code so far.


But it only seems to work on the actual template, but not after the data has been merged. Is it possible to maybe reference the template for the data instead of the ActiveDocument?
Thank you

Last edited by macropod; 12-19-2017 at 02:39 PM. Reason: Added code tags
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Mail Merge Empty Data Field Licos101 Mail Merge 2 04-10-2014 06:19 AM
Use a the data from a mail merge field How to ignore a mail merge field if the field is blank redzan Mail Merge 1 05-16-2013 08:34 AM
Merge field source data field kckay Mail Merge 4 03-25-2013 11:06 AM
Use a the data from a mail merge field Mail Merge - If a field is black, take the data from the row below? mikeprent Mail Merge 5 01-05-2012 04:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft