Im after code to convert Word to PDF

Lanason

Registered User.
Local time
Today, 19:40
Joined
Sep 12, 2003
Messages
258
Hello Everyone,

I'm looking for some simple code to copy a ABC.docx into a ABC.pdf format . . I can do all the paths / filenames etc just need the bit to convert/export/save

Thank you in advance
 
Hello Everyone,

I'm looking for some simple code to copy a ABC.docx into a ABC.pdf format . . I can do all the paths / filenames etc just need the bit to convert/export/save

Thank you in advance
Yeah, you mean like "Save As" to PDF using code? If so, did you want to use the code within Word or Access?
 
The code below can help.

Code:
 Alt SaveAsWordToPDF ()

    Dim strFileName As String
    WordApp Olarak Sönük WordAppApp

    strpath = "F: \ PDF Dosyaları \"
    strFileName = "ABC.docx"


    Set WordApp = CreateObject ("Word.Application")
    WordApp.Documents.Open strpath & strFileName
           
'.doc veya .docx'i dosya adından kaldır
    UCase (Sağ (ActiveDocument.name, 1)) = "X"
'.docx
        strFileName = Sol (ActiveDocument.name, Len (ActiveDocument.name) - 5)
    Başka
'.doc
        strFileName = Sol (ActiveDocument.name, Len (ActiveDocument.name) - 4)
    End If

'PDF dosyasını yaz
    WordApp.ActiveDocument.ExportAsFixedFormat _
            OutputFileName: = ActiveDocument.Path & "\" & strFileName & ".pdf", _
            ExportFormat: = wdExportFormatPDF, _
            OpenAfterExport: = Yanlış, _
            OptimizeFor: = wdExportOptimizeForPrint, _
            Aralık: = wdExportAllDocument, _
            Öğe: = wdExportDocumentContent, _
            IncludeDocProps: = Doğru, KeepIRM: = Doğru, _
            CreateBookmarks: = wdExportCreateNoBookmarks, _
            DocStructureTags: = Doğru, _
            BitmapMissingFonts: = Doğru, _
            UseISO19005_1: Yanlış =

    WordApp.Quit
    WordApp Ayarla = Hiçbir şey

' hepsi tamam
    MsgBox "PDF tamamlandı"

End Sub
[/ CODE]


Don't forget, you'll need a reference to the Microsoft Word Object Library for this to work.
 

Users who are viewing this thread

Back
Top Bottom