Hallo!
Ich hab das Problem so gelöst:
Sub CATMain()
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim productDocument1 As Document
Dim filesystem1 As Object
Set filesystem1 = CATIA.FileSystem
Dim file As Object
Dim Pfad As String
FileNum = FreeFile()
Open ("d:\temp\info.txt") For Input As FileNum
Input #FileNum, Pfad
Input #FileNum, Datei
Close #FileNum
Set productDocument1 = documents1.Open(Pfad & Datei)
End Sub
Der Pfad und der Dateiname der zu öffnenden CATIA-Dateien sind in einem Textfile abgespeichert, wie z.B.:
d:\temp\CATIA_FEM\
Product1.CATProduct
=> hier OHNE ""; WICHTIG: in zwei Zeilen!
Bei solchen Dateioperationen Fehlermeldungen bei fehlenden Dateien nicht vergessen:
Set fs = CreateObject("Scripting.FileSystemObject")
'...
FolderExists = fs.FolderExists(Pfad)
'...
FileExists = fs.FileExists(Pfad & "info.txt")
'...
If FolderExists = False Then
MsgBox ("Pfad " & Pfad & " does not exist!!!")
End 'Programm beenden
End If
If FileExists = False Then
MsgBox ("Datei " & Pfad & "info.txt does not exist!!!")
End 'Programm beenden
End If
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP