Hilfe bei Comate

Anfängerfragen zum Programmieren mit PureBasic.
appndown
Beiträge: 9
Registriert: 07.05.2015 21:54

Hilfe bei Comate

Beitrag von appndown »

Hi,

ich verstehe das mit Comate einfach nicht...

Ich möchte ein Word Doc öffnen und als PDF abspeichern...
Egal was ich versuche es klapp einfach nicht.

Ich hab mir mal das als Markro in Word aufgezeichnet, aber wie setzt man das in Comate um ?
Bitte, kann mir nicht jemand helfen ?

Das Markro:

ActiveDocument.ExportAsFixedFormat OutputFileName:= _
"C:\Users\appnd\Desktop\ComateTest.pdf", ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
True, UseISO19005_1:=False

Gruß
Sascha
Benutzeravatar
Kiffi
Beiträge: 10711
Registriert: 08.09.2004 08:21
Wohnort: Amphibios 9

Re: Hilfe bei Comate

Beitrag von Kiffi »

Code: Alles auswählen

XIncludeFile "\Dein\Pfad\Zu\COMatePLUS.pbi"

EnableExplicit

#wdExportFormatPDF = 17

Define MyWordDoc.s = "\Dein\Pfad\Zum\Einzulesenden\doc.doc"
Define MyWordPdf.s = "\Dein\Pfad\Zum\Exportierenden\pdf.pdf"

Define WordApplication.COMateObject

WordApplication = COMate_CreateObject("Word.Application")

If WordApplication
  WordApplication\Invoke("Documents\Open('" + MyWordDoc + "')")
  WordApplication\Invoke("ActiveDocument\ExportAsFixedFormat('" + MyWordPdf + "', " + Str(#wdExportFormatPDF) + ")")
  WordApplication\Invoke("Quit")
  WordApplication\Release()
Else
  MessageRequester("COMate", "Couldn't create WordApplication!")
EndIf
Grüße ... Peter
a²+b²=mc²
Antworten