ich sitze vor einem Problem und auch die Suche war bislang erfolglos.
Ich muss PDF Dokumente mittels eines Makros in ein anderes Format konvertieren. Da hier stellenweise sehr komische Einstellungen vorhanden sind wäre mein Ansatz es über einen PDF Printer in Shell zu machen. Leider kann ich den Output-Pfad und -File nicht vorbelegen und muss es File für File bestätigen. Hat jemand eine Idee, wie ich das hinbekomme?
Hier der Code-Schnipsel:
Private Declare
Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long
Sub drucken()
Const SW_SHOWNORMAL = 2
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objWord = CreateObject("Word.Application")
Set WshShell = CreateObject("WScript.Shell")
strInitialPath = "c:\temp"
objWord.ChangeFileOpenDirectory (strInitialPath)
With objWord.FileDialog(msoFileDialogOpen)
.Title = "Select the files to convert"
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "pdf Files", "*.pdf"
.Filters.Add "All Files", "*.*"
If .Show = -1 Then
For Each File In .SelectedItems
Set objfile = FSO.GetFile(File)
result = ShellExecute(0, "printto", objFile,_
"CIB pdf brewer", "c:\test.pdf", SW_SHOWNORMAL)
DoEvents
Next
End If
End With
End Sub