Hallo zusammen,
ich komme hier leider nicht ganz weiter. Ich möchte das das Makro mir unter Einhalt einer vordefinierten Bezeichnung eine pdf erstellt. Hier soll aber auch ein bestimmter Pfad als Vorauswahl dienen. Bezeichnung spuckt er korrekt aus, den Pfad aber nicht. Außerdem kommt die Meldung "Falscher Parameter". Vielleicht kann mir jemand weiter helfen
Public Sub TestFileDialog()
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
'Eigenschaften definieren
Dim customPropSet As PropertySet
Set customPropSet = oDoc.PropertySets.Item("Inventor User Defined Properties")
Dim customPropItemCode1 As Property
Set customPropItemCode1 = customPropSet.Item("Title")
Dim customPropItemCode2 As Property
Set customPropItemCode2 = customPropSet.Item("Revision")
Dim Titel
Titel = customPropItemCode1.Value
Dim Revi
Revi= customPropItemCode2.Value
' Create a new FileDialog object.
Dim oFileDlg As FileDialog
Call ThisApplication.CreateFileDialog(oFileDlg)
oFileDlg.FileName = Titel & "_" & Revi
' Define the filter to select part and assembly files or any file.
oFileDlg.Filter = "Inventor Files (*.pdf"
' Define the part and assembly files filter to be the default filter.
oFileDlg.FilterIndex = 1
' Set the title for the dialog.
oFileDlg.DialogTitle = "Speichern der Datei"
' Set the initial directory that will be displayed in the dialog.
oFileDlg.InitialDirectory = "C:\Users\XX"
' Set the flag so an error will be raised if the user clicks the Cancel button.
oFileDlg.CancelError = True
' Show the open dialog. The same procedure is also used for the Save dialog.
' The commented code can be used for the Save dialog.
On Error Resume Next
'oFileDlg.ShowOpen
oFileDlg.ShowSave
' If an error was raised, the user clicked cancel, otherwise display the filename.
If Err Then
MsgBox "Speichern des Dokumentes abgebrochen"
ElseIf oFileDlg.FileName <> "" Then
MsgBox "File " & oFileDlg.FileName & " was selected."
End If
End Sub
Vielen Dank!
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP