Adding a Dropdown box to a Dialog box.

C

ChristyC

I am trying to add a drop down box to a Dialog box that is created on the fly
when a user selects a button located in the tool bar. I know the code to
create textbox, option buttons, and buttons. Can someone please help. I
have looked everywhere for a sample code module with no luck.

CODE for the Dialog box:
WordBasic.BeginDialog 606, 260, "TxDOT Memorandum Information"
WordBasic.Text 24, 11, 123, 13, "Memo Recipient", "Text1"
WordBasic.TextBox 24, 28, 301, 18, "Recipient$"
WordBasic.Text 24, 53, 108, 13, "Memo Sender", "Text2"
WordBasic.TextBox 24, 69, 302, 18, "Sender$"
WordBasic.Text 24, 93, 108, 13, "Memo Subject", "Text3"
WordBasic.TextBox 24, 110, 302, 18, "Sub$"
WordBasic.OKButton 364, 40, 123, 21
WordBasic.CancelButton 364, 80, 123, 21
WordBasic.EndDialog
 
J

Jean-Guy Marcil

ChristyC was telling us:
ChristyC nous racontait que :
I am trying to add a drop down box to a Dialog box that is created on
the fly when a user selects a button located in the tool bar. I know
the code to create textbox, option buttons, and buttons. Can someone
please help. I have looked everywhere for a sample code module with
no luck.

CODE for the Dialog box:
WordBasic.BeginDialog 606, 260, "TxDOT Memorandum Information"
WordBasic.Text 24, 11, 123, 13, "Memo Recipient", "Text1"
WordBasic.TextBox 24, 28, 301, 18, "Recipient$"
WordBasic.Text 24, 53, 108, 13, "Memo Sender", "Text2"
WordBasic.TextBox 24, 69, 302, 18, "Sender$"
WordBasic.Text 24, 93, 108, 13, "Memo Subject", "Text3"
WordBasic.TextBox 24, 110, 302, 18, "Sub$"
WordBasic.OKButton 364, 40, 123, 21
WordBasic.CancelButton 364, 80, 123, 21
WordBasic.EndDialog

Why use this method?
I haven't use this since, gosh, I don't remember how long it has been...
This was last seen with Word 95...
In geek years, this is ancient!

Why don't you use a real userform instead?
Much more powerful and easier to maintain!

For the way it has been done since Word 97, see:
http://word.mvps.org/faqs/Userforms/index.htm

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
C

ChristyC

I know that this is the old way, because I wrote it about 9 years ago. It is
a very complex macro that I really don't have the time to redo right now. It
works great, but I just don't remeber the ancient way of doing the combobox.


Jean-Guy Marcil said:
ChristyC was telling us:
ChristyC nous racontait que :
I am trying to add a drop down box to a Dialog box that is created on
the fly when a user selects a button located in the tool bar. I know
[quoted text clipped - 13 lines]
WordBasic.CancelButton 364, 80, 123, 21
WordBasic.EndDialog

Why use this method?
I haven't use this since, gosh, I don't remember how long it has been...
This was last seen with Word 95...
In geek years, this is ancient!

Why don't you use a real userform instead?
Much more powerful and easier to maintain!

For the way it has been done since Word 97, see:
http://word.mvps.org/faqs/Userforms/index.htm
 
J

Jean-Guy Marcil

ChristyC was telling us:
ChristyC nous racontait que :
I know that this is the old way, because I wrote it about 9 years
ago. It is a very complex macro that I really don't have the time to
redo right now. It works great, but I just don't remeber the ancient
way of doing the combobox.

OK, if you insist...

Try this:

'To add 5 items to the dropdown box:
ReDim MyList$(4)
MyList$(0) = "Item 1"
MyList$(1) = "Item 2"
MyList$(2) = "Item 3"
MyList$(3) = "Item 4"
MyList$(4) = "Item 5"

WordBasic.DropListBox 206, 312, 250, 45, MyList$(), "ControlName"


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
C

ChristyC

Thank You! That hit the stop!

Jean-Guy Marcil said:
ChristyC was telling us:
ChristyC nous racontait que :


OK, if you insist...

Try this:

'To add 5 items to the dropdown box:
ReDim MyList$(4)
MyList$(0) = "Item 1"
MyList$(1) = "Item 2"
MyList$(2) = "Item 3"
MyList$(3) = "Item 4"
MyList$(4) = "Item 5"

WordBasic.DropListBox 206, 312, 250, 45, MyList$(), "ControlName"
 
J

Jay Freedman

I know that this is the old way, because I wrote it about 9 years ago. It is
a very complex macro that I really don't have the time to redo right now. It
works great, but I just don't remeber the ancient way of doing the combobox.
I don't remember it either (some days I have trouble remembering
breakfast <g>), but you can download the old WordBasic help file from
http://www.microsoft.com/downloads/release.asp?ReleaseID=26572.

Good luck!

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top