Sub CATMain()
''On Error Resume Next
Dim a(1000)
CATIA.DisplayFileAlerts = False
N = CATIA.Documents.Count
For i = 1 To N
Set odrw = CATIA.Documents.Item(i)
Set a(i) = odrw
Next
For i = 1 To N
Set odrw = a(i)
If TypeName(odrw) = "DrawingDocument" Then
opath = odrw.Path
oname = odrw.Name
oname = Left(oname, (Len(oname) - 11))
odrw.ExportData opath & "\" & oname & ".dwg", "dwg"
odrw.ExportData opath & "\" & oname & ".pdf", "pdf"
odrw.Close
End If
Next
End Sub