Hi Everyone,
I know this topic is well-discussed in the forum but I haven't found any working macro I want, maybe the version number difference is the problem, I have V5-6 R2014. And I am quite new in this macro topic so I need a lot help.
I would like to make a macro to save multiple drawings to pdf without opening them. The drawings have 3 sheets and I just want to save only the first one.
I found this code shown below and it works well but saves all the sheet in the drawing to the pdf and I want only the first sheet. And it would be great if the filename would not contain the xxxx.CATDrawing.pdf ending.
The other thing is that this code want to open every file in the folder, and I just want the macro to open only .CADDrawing filetypes.
For starters I would be happy if these methods will work.
Language="VBSCRIPT"
Sub CATMain()
folderinput = InputBox ("Take your files from here","Input","",2000,4000)
folderoutput = InputBox ("Put your files here","Output","",2000,4000)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderinput)
Set fc = f.Files
For Each f1 in fc
Dim PartDocument1 'As Document
Set documents1 = CATIA.Documents
Dim document1 'As Document
INTRARE = folderinput & f1.name
Set PartDocument1 = CATIA.Documents.Open(INTRARE)
IESIRE = folderoutput & f1.name & ".pdf"
PartDocument1.ExportData IESIRE, "pdf"
s = s & f1.name
s = s & vbCrLf
CATIA.ActiveDocument.Close
Next
End Sub
Thank You in advance!
I know this topic is well-discussed in the forum but I haven't found any working macro I want, maybe the version number difference is the problem, I have V5-6 R2014. And I am quite new in this macro topic so I need a lot help.
I would like to make a macro to save multiple drawings to pdf without opening them. The drawings have 3 sheets and I just want to save only the first one.
I found this code shown below and it works well but saves all the sheet in the drawing to the pdf and I want only the first sheet. And it would be great if the filename would not contain the xxxx.CATDrawing.pdf ending.
The other thing is that this code want to open every file in the folder, and I just want the macro to open only .CADDrawing filetypes.
For starters I would be happy if these methods will work.
Language="VBSCRIPT"
Sub CATMain()
folderinput = InputBox ("Take your files from here","Input","",2000,4000)
folderoutput = InputBox ("Put your files here","Output","",2000,4000)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderinput)
Set fc = f.Files
For Each f1 in fc
Dim PartDocument1 'As Document
Set documents1 = CATIA.Documents
Dim document1 'As Document
INTRARE = folderinput & f1.name
Set PartDocument1 = CATIA.Documents.Open(INTRARE)
IESIRE = folderoutput & f1.name & ".pdf"
PartDocument1.ExportData IESIRE, "pdf"
s = s & f1.name
s = s & vbCrLf
CATIA.ActiveDocument.Close
Next
End Sub
Thank You in advance!