[AccessD] auto save in word

Pedro Janssen pedro at plex.nl
Sun May 23 16:03:05 CDT 2004


Hello Group,


After merging data from access with use of properties in word, i use the code below to save a word document in a certain directory with the name; Bezoekrapport("BezoekrapportID").doc, by clicking a button. When the documentname in the directory already excist i would have the name changed to  Bezoekrapport("BezoekrapportID")_1.doc or Bezoekrapport("BezoekrapportID")_2.doc   etc, etc. Can this been done?


Pedro Janssen

 

Sub BezoekRapportOpslag()
 
    For Each prop In ActiveDocument.CustomDocumentProperties
        If prop.Name = "BezoekRapportID" Then
            strFileNamePart = prop.Value
            Exit For
        End If
    Next
 
    strFilename = "W:\Werkbrieven Opslag\Bezoekrapport\Bezoekrapport" & strFileNamePart & ".doc"
 
    ActiveDocument.SaveAs FileName:=strFilename
    
End Sub 



More information about the AccessD mailing list