I am creating a macro in Excel that takes x and y data from a worksheet and then brings them into a CATIA drawing and draws lines. I can get it to draw the lines just fine, but I am having trouble formatting the lines. The problem seems to be with the ".Selection" part. I get the error "Object doesn't support this property or method". Is there another way to format lines without .Selection? I don't know if it makes a difference, but I am doing this in V6.
Sub CATMain()
Dim CATIA As Object
Set CATIA = GetObject(, "CATIA.Application" )
Set DrwDocument = CATIA.ActiveDocument
Set DrwSheets = DrwDocument.Sheets
Set DrwSheet = DrwSheets.ActiveSheet
Set DrwView = DrwSheet.Views.ActiveView
Set Fact = DrwView.Factory2D
Dim Line1 As Object
Set Line1 = Fact.CreateLine(0, 0, Range("A1").Value, Range("B1").Value)
Line1.Name = "Line1"
CATIA.ActiveDocument.Selection.VisProperties.SetRealWidth 3,1
End Sub
Sub CATMain()
Dim CATIA As Object
Set CATIA = GetObject(, "CATIA.Application" )
Set DrwDocument = CATIA.ActiveDocument
Set DrwSheets = DrwDocument.Sheets
Set DrwSheet = DrwSheets.ActiveSheet
Set DrwView = DrwSheet.Views.ActiveView
Set Fact = DrwView.Factory2D
Dim Line1 As Object
Set Line1 = Fact.CreateLine(0, 0, Range("A1").Value, Range("B1").Value)
Line1.Name = "Line1"
CATIA.ActiveDocument.Selection.VisProperties.SetRealWidth 3,1
End Sub