×
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

Linking Autocad Area to VBA TextBox?

Linking Autocad Area to VBA TextBox?

Linking Autocad Area to VBA TextBox?

(OP)
Hi all,

I have a question I would like to ask about linking my vba programme to the "area" on autocad, I have written my program as a simple weight calculation program like this:
(Thanks to ab123456, msmith & johnwm on my last post)

Private Sub ComboBox1_Change()

End Sub

Private Sub UserForm_Initialize()
   With ComboBox1
     .AddItem "Steel"
     .List(.ListCount - 1, 1) = "7.85"
     .AddItem "Aluminum"
     .List(.ListCount - 1, 1) = "2.60"
     .AddItem "Bronze"
     .List(.ListCount - 1, 1) = "8.46"
     .AddItem "Cast-Iron"
     .List(.ListCount - 1, 1) = "7.22"
     .AddItem "Oil"
     .List(.ListCount - 1, 1) = "0.85"
     .AddItem "Water"
     .List(.ListCount - 1, 1) = "1.00"
   End With
End Sub

Private Sub CommandButton1_Click()

If TextBox3.Text = "" Then
    TextBox4.Text = TextBox1.Text * TextBox2.Text
    TextBox5.Text = TextBox4.Text / 1000000
    TextBox6.Text = TextBox4.Text * ComboBox1.Value * 0.000001
Else
    TextBox4.Text = TextBox1.Text * TextBox3.Text * 6.283185
    TextBox5.Text = TextBox4.Text / 1000000
    TextBox6.Text = TextBox4.Text * ComboBox1.Value * 0.000001
End If
End Sub

Private Sub CommandButton2_Click()
End
End Sub


Private Sub UserForm_Click()

End Sub

In TextBox2 is my cross sectional area of a polygon, region etc, what I would like it to do is that when I open my vba program I would like it to automatically input the "area" of the polygon, region into TextBox2.

Is this possible? and if so does anyone have any pointers?

Thanks everybody.

RE: Linking Autocad Area to VBA TextBox?

Hi bdickens,

Well, sort of...  You'll want to look into XData and figure out a strategy for maintaining these, if these are typical type drawings or something you can create programmically, attaching XData isn't too painful, but if these are dynamic (meaning your areas will change frequently, or your users create) you may be better off forcing your users to select the areas you want to populate your box.

HTH
Todd

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