scubastu Posted November 16, 2009 Share Posted November 16, 2009 Hi CADaholics, I am just starting vba and I have designed a UserForm with combination text and command buttons. There is a Pick button to let user pick a point in Graphics screen and return to Userform. How do I get the coordinates to display in the Northing textbox, Easting textbox etc.. e.g set the value of the textbox with the right variable and display it. I have actually already written the program in Lisp but would like to go vba or maybe dcl would be easier? Thanks Scuba Quote Link to comment Share on other sites More sharing options...
jalucerol Posted November 16, 2009 Share Posted November 16, 2009 ThisDrawing.Utility.GetPoint Quote Link to comment Share on other sites More sharing options...
fixo Posted November 16, 2009 Share Posted November 16, 2009 Hi CADaholics, I am just starting vba and I have designed a UserForm with combination text and command buttons. There is a Pick button to let user pick a point in Graphics screen and return to Userform. How do I get the coordinates to display in the Northing textbox, Easting textbox etc.. e.g set the value of the textbox with the right variable and display it. I have actually already written the program in Lisp but would like to go vba or maybe dcl would be easier? Thanks Scuba Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well. ~'J'~ Quote Link to comment Share on other sites More sharing options...
scubastu Posted November 17, 2009 Author Share Posted November 17, 2009 Ok I got this from autocad2006 VBA book by Joe Sutphin. It works ok I think but I want the resulting coordinates from the pick point physically displayed in the right text boxes on the User form. Do I write something under txt1X_change()? In other words, give the user a chance to write coordinates in or pick coordinates from ACAD graphics screen. Private Sub cmdPick_Click() Dim Point As Variant On Error Resume Next 'hide the UserForm Traverse.Hide 'ask user to select a point Point = ThisDrawing.Utility.GetPoint(, "Select a Point") If Err Then Exit Sub 'assign values to appropriate textbox txt1X = Point(0): txt1Y = Point(1): txt1Z = Point(2) 'redisplay the UserForm Traverse.Show End Sub Quote Link to comment Share on other sites More sharing options...
SEANT Posted November 17, 2009 Share Posted November 17, 2009 If the “txt1” refer to textbox then this should work: Traverse.txt1X.Text = Cstr(Point(0)) Traverse.txt1Y.Text = Cstr(Point(1)) Traverse.txt1Z.Text = Cstr(Point(2)) VBA would likely do the type conversion for you, but an explicit Cstr() can’t hurt. Quote Link to comment Share on other sites More sharing options...
scubastu Posted November 18, 2009 Author Share Posted November 18, 2009 If the “txt1” refer to textbox then this should work: Traverse.txt1X.Text = Cstr(Point(0)) Traverse.txt1Y.Text = Cstr(Point(1)) Traverse.txt1Z.Text = Cstr(Point(2)) VBA would likely do the type conversion for you, but an explicit Cstr() can’t hurt. Hey Thanks alot Seant! thats perfect! was probably pretty simple but now I can confuse my brain even more and try and write the rest!:wink: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.