Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Autocad Area to VBA TextBox?

Status
Not open for further replies.

bdickens

Mechanical
Sep 19, 2005
13
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.
 
Replies continue below

Recommended for you

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor