Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

Use Combo Box to set bookmark text.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JGJP - 11 Aug 2006 17:52 GMT
Hi,

I'm trying to create a document that allows the user to choose text in
a drop down and fill that result elsewhere. (We do not want the drop
down to show in a printout.)

I was looking at the InsertBefore range, but that wouldn't replace the
contents if the user changes the selection in the drop down.

For example:

Choose the animal: DROPDOWN

Animal Chosen: RESULT

Can you get me started?

JG
Jean-Guy Marcil - 11 Aug 2006 18:10 GMT
JGJP was telling us:
JGJP nous racontait que :

> Hi,
>
[quoted text clipped - 12 lines]
>
> Can you get me started?

Yes, but to avoid confusion and wasting time, are you writing about a
dropdown as in a form field from the Form Toolbar (so as to create a
document protected for forms), or are you referring to a dropdown on a
userform?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

JGJP - 11 Aug 2006 19:33 GMT
> Yes, but to avoid confusion and wasting time, are you writing about a
> dropdown as in a form field from the Form Toolbar (so as to create a
> document protected for forms), or are you referring to a dropdown on a
> userform?

Bonjour,

I am refering to a Combobox from the Control Toolbox.

A Form field would have worked nicely for me, except I can't protect
the document because I need to be able to insert files into the
document.

Merci,

Jeanne
Doug Robbins - Word MVP - 11 Aug 2006 21:21 GMT
Rather than the combo box from the Control Toolbar in the document itself,
use a combobox in a UserForm.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>> Yes, but to avoid confusion and wasting time, are you writing about a
>> dropdown as in a form field from the Form Toolbar (so as to create a
[quoted text clipped - 12 lines]
>
> Jeanne
Cindy M. - 12 Aug 2006 10:49 GMT
Hi Jgjp,

> I'm trying to create a document that allows the user to choose text in
> a drop down and fill that result elsewhere. (We do not want the drop
[quoted text clipped - 8 lines]
>  
> Animal Chosen: RESULT

You are already able to populate the combobox, I take it?

Then you need to use either the Change or the LostFocus event. Change
will fire with everything that is typed (or deleted). LostFocus fires
when the user leaves the field - you need to be careful with that if
you're using GotFocus and LostFocus with any other controls.

The basic code would be
   Dim doc as Word.document
   Dim bkmName as String
   Dim rng as Word.range

   Set doc = ActiveDocument
   bkmName = "xyz"
   If doc.Bookmarks.Exists(bkmName) Then
       Set rng = doc.Bookmarks(bkmName)
       rng.Text = combobox1.Text
       doc.Bookmarks.add bkmName, rng
   End IF

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
JGJP - 12 Aug 2006 10:59 GMT
> Then you need to use either the Change or the LostFocus event. Change
> will fire with everything that is typed (or deleted). LostFocus fires
[quoted text clipped - 18 lines]
> http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
> http://www.word.mvps.org

Great! I'll give that a try. Yes, I do know how to populate the combo
box.

Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.