View Single Post
 
Old 12-19-2017, 02:34 PM
pttsv pttsv is offline Windows 10 Office 2013
Novice
 
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