Rubrik: Word | VB-Versionen: VBA, Access | 16.06.09 |
Convert doc2pdf für Word 2007 Hier ein kleines Minimakro, um ein Word-Dokument beispielsweise als PDF abzuspeichern. | ||
Autor: Heiko Jendreck | Bewertung: | Views: 66.802 |
www.phw-jendreck.de | System: WinXP, Win7, Win8, Win10, Win11 | kein Beispielprojekt |
Nachfolgend ein kleines Makro, um ein Word-Dokument als PDF zu speichern.
Dim sPDFFile As String ' an dieser Stelle bitte den Pfad und Dateinamen angeben sPDFFile = "C:\test.pdf" ' Dokument als PDF speichern oActiveDocument.SaveAs sPDFFile, 17
Voraussetzung dafür ist MS-Word ab Version 2007, sowie das AddIn von Microsoft "SaveAsPDF".
Dieses kann hier kostenfrei heruntrgeladen werden.
Quelle: Microsoft MSDN
Weitere Formate:
Name | Value | Description |
wdFormatDocument | 0 | Microsoft Office Word format. |
wdFormatDOSText | 4 | Microsoft DOS text format. |
wdFormatDOSTextLineBreaks | 5 | Microsoft DOS text with line breaks preserved. |
wdFormatEncodedText | 7 | Encoded text format. |
wdFormatFilteredHTML | 10 | Filtered HTML format. |
wdFormatHTML | 8 | Standard HTML format. |
wdFormatRTF | 6 | Rich text format (RTF). |
wdFormatTemplate | 1 | Word template format. |
wdFormatText | 2 | Microsoft Windows text format. |
wdFormatTextLineBreaks | 3 | Windows text format with line breaks preserved. |
wdFormatUnicodeText | 7 | Unicode text format. |
wdFormatWebArchive | 9 | Web archive format. |
wdFormatXML | 11 | Extensible Markup Language (XML) format. |
wdFormatDocument97 | 0 | Microsoft Word 97 document format. |
wdFormatDocumentDefault | 16 | Word default document file format. For Microsoft Office Word 2007, this is the DOCX format. |
wdFormatPDF | 17 | PDF format. |
wdFormatTemplate97 | 1 | Word 97 template format. |
wdFormatXMLDocument | 12 | XML document format. |
wdFormatXMLDocumentMacroEnabled | 13 | XML document format with macros enabled. |
wdFormatXMLTemplate | 14 | XML template format. |
wdFormatXMLTemplateMacroEnabled | 15 | XML template format with macros enabled. |
wdFormatXPS | 18 | XPS format. |