×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Formating lines in a CATIA drawing from a macro in Excel

Formating lines in a CATIA drawing from a macro in Excel

Formating lines in a CATIA drawing from a macro in Excel

(OP)
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

RE: Formating lines in a CATIA drawing from a macro in Excel

(OP)
Changing .ActiveDocument to .ActiveEditor worked.

Thanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources