Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Extra! dialog boxes to VBA forms. 1

Status
Not open for further replies.

Griffon2104

Technical User
Nov 29, 2004
4
CA
I'm trying to migrate my code to VBA and I don't know much VBA (yet, I imagine I'll learn alot doing this.).

So, for example I have:
Begin Dialog newdlg 71, 28, 172, 103, "Autoreset"
TextBox 65, 15, 40, 13, .userid
TextBox NoEcho 115, 15, 50, 13, .userpasswd
TextBox 65, 50, 40, 13, .theirid
DropComboBox 114, 49, 52, 40, totalrnd, .newpasswd
CheckBox 63, 77, 64, 10, "Unlock only?", .CheckBox1
OkButton 6, 89, 50, 14
CancelButton 65, 89, 50, 14
PushButton 122, 89, 50, 14, "Ad&vanced", .button1
OptionGroup .OptionGroup1
OptionButton 4, 17, 54, 11, "1", .OptionButton1
OptionButton 4, 28, 54, 11, "2", .OptionButton2
OptionButton 3, 39, 54, 11, "3", .OptionButton4
OptionButton 3, 50, 54, 11, "4", .OptionButton5
OptionButton 4, 6, 54, 11, "5", .OptionButton6
OptionButton 3, 61, 54, 11, "6", .OptionButton7
GroupBox 59, 6, 48, 30, "Your ID"
GroupBox 110, 6, 60, 30, "Your password"
GroupBox 60, 40, 48, 30, "Their ID"
GroupBox 110, 40, 60, 30, "New password"
End Dialog

.. more boxes here...

Dim mydialogbox As newdlg

... more junky code here ...

Dim Advwindow
advwindow = Dialog(mydialogbox)

Ok, the question is how do I get this into a VBS form and how can I call it properly? Am I going to have to change all of my outputs or is there an easy way to do this?

 
There is not an easy copy/paste way to make this happen. VB(A) is driven by the form. In other words you have a form appear and control the code, instead of the code necessarily controling the form.

In VBA, add a form. Then add the objects (controls) that you're box needs. You'll find it's much easier as it's visually based (thus the name). Then you put code in the cmdOK button that does the work or calls a sub/function that does the work.

This is the hardest part of making the transition. I believe strongly that it is worth the effort.

calculus
 
Thanks again Calculus.

I feel like I'm chasing a turkey having to restructure most of this code :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top