Hi Bill,
Thanks for your suggestion.
This is the code in msaccess:
Private Sub cmdExhibits_Click()
Set Wrd = CreateObject("Word.Application")
strMergeDoc = Application.CurrentProject.path
strMergeDoc = strMergeDoc + "\Exhibits.dotx"
Wrd.Documents.Add strMergeDoc
With Wrd.ActiveDocument.Bookmarks
.Item("EXHIBITSLIST").Range.Text = strExhibits.Item("WITNESSLIST").Range.Text = strWitnesses
.Item("CASENO").Range.Text = Me.txtClaimNo
.Item("CLIENTNAME").Range.Text = Me.ClientName
End With
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
dbdir = Left$(strDBPath, Len(strDBPath) - Len(strDBFile))
strFileTempWord = dbdir & "TempWordDoc.Doc"
DoEvents
If FileExists(strFileTempWord) Then Kill strFileTempWord
Wrd.ActiveDocument.SaveAs strFileTempWord
strDirWord = "\\192.168.164.4\c$\WORDSERVER\EXHIBIT LIST - MASTERS\"
strFileWordName = "Exhibits " & Me.ClientName & " " & Me.txtClaimNo & ".pdf"
strFileWord = strDirWord & strFileWordName
'20141121----------------------------------------convert word to pdf-------------------------------
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
strFileWord, ExportFormat:= _
wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
Wrd.Quit
Set Wrd = Nothing
strDirWord = "\\server2008\WORDSERVER\EXHIBIT LIST - MASTERS\"
strFileWordName = "Exhibits " & Me.ClientName & " " & Me.txtClaimNo & ".doc"
strFileWord = strDirWord & strFileWordName
If FileExists(strFileTempWord) Then Call CopyFile(strFileTempWord, strFileWord)
On Error GoTo 0
Exit Sub
cmdExhibits_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdExhibits_Click of VBA Document Form_frmExhibits"
End Sub
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Warmest regards
Norbert
Posted by: drnorbert@msn.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (3) |
Tidak ada komentar:
Posting Komentar