I'm trying to read the description of product file from the drawing for our title block program.
If I run the Macro below I get an Error at "Set productDocument1 = documents1.Item(Str)" complaining "the method Item failed". If I just enter the file name "Set productDocument1 = documents1.Item("filename.CATProduct") it works as long as the product is in the same directory as the drawing I have up at the time. But our files are located in a bunch of different directories so I need to enter the full path.
Language="VBSCRIPT"
Sub CATMain()
Dim documents1 As Documents
Dim Str as String
Set documents1 = CATIA.Documents
Dim productDocument1 As Document
Str = "V:\V_Projects\batterypack AA\Product14.CATProduct"
Set productDocument1 = documents1.Item(Str)
Dim product1 As Product
Set product1 = productDocument1.Product
'product1.DescriptionRef = "This is the New DDDescription"
msgbox product1.DescriptionRef
End Sub
If I run the Macro below I get an Error at "Set productDocument1 = documents1.Item(Str)" complaining "the method Item failed". If I just enter the file name "Set productDocument1 = documents1.Item("filename.CATProduct") it works as long as the product is in the same directory as the drawing I have up at the time. But our files are located in a bunch of different directories so I need to enter the full path.
Language="VBSCRIPT"
Sub CATMain()
Dim documents1 As Documents
Dim Str as String
Set documents1 = CATIA.Documents
Dim productDocument1 As Document
Str = "V:\V_Projects\batterypack AA\Product14.CATProduct"
Set productDocument1 = documents1.Item(Str)
Dim product1 As Product
Set product1 = productDocument1.Product
'product1.DescriptionRef = "This is the New DDDescription"
msgbox product1.DescriptionRef
End Sub