AW: Generieren von PDFs anderer Office Dokumente
28.11.2011 10:39:49
PDFs
Hallo, :-)
für eine Datei so:
Option Explicit
Const strFilePath As String = "C:\Temp\"
Private Const visDocExIntentPrint = 1
Private Const visPrintCurrentPage = 2
Private Const visFixedFormatPDF = 1
Private Const visPrintAll = 0
Private Const visOpenRW = 32
Sub Main()
Dim objVisioApp As Object
Dim blnTMP As Boolean
On Error GoTo Fin
Set objVisioApp = CreateObject("Visio.Application")
With objVisioApp
.Visible = False
.Documents.OpenEx strFilePath & "Test.vsd", visOpenRW
.Documents(1).ExportAsFixedFormat visFixedFormatPDF, _
strFilePath & Left(.Documents(1).Name, _
InStrRev(.Documents(1).Name, ".")) & "pdf", _
visDocExIntentPrint, visPrintAll
DoEvents
Do
blnTMP = FileExist(strFilePath)
Loop Until blnTMP = True
.Documents(1).Close
End With
Fin:
If Not objVisioApp Is Nothing Then objVisioApp.Quit
Set objVisioApp = Nothing
If Err.Number 0 Then MsgBox "Error: " & _
Err.Number & " " & Err.Description
End Sub
Private Function FileExist(ByVal strFileName As String) As Boolean
FileExist = IIf(Len(Dir(strFileName)) = 0, False, True)
End Function
Das Objektmodell von VISIO gibt es z. B. hier:
Objektmodell VISIO
Servus
Case