Combobox using document variables as data?

S

Sophia

Hello ...

Is it possible to use the Word97 toolbar to insert a combobox in a
document, where the data entered into the combobox is stored (like a
document variable) in the document?

If it's possible to do that, could you please refer me to some sites
where I can find basic information on how to work with that/

My plan is to use a button on a toolbar to insert a combobox in a
recently-opened rtf document.

After that, to allow the user to enter a list of "SearchWords" into
the combobox, and then write some code that will refer to the list and
accomplish the following:

For each Section in the document,
For each SearchWord stored in the combobox,
Find the first instance of the SearchWord in the Section
Format the SearchWord found in the document to "Bold"
Next section

Is this feasible ... or will I require a UserForm with a combobox on
it that is populated from Document Variables?

Need some suggestions ... am willing to do my homework if you'll point
me in the right direction ...

TIA

Sophia
 
S

Sophia

Hello ...

Decided to use a UserForm for this (something I understand a bit
about), and put ten textboxes on the UserForm instead of the combox
box, since it enables the user to see them all at a glance.

I'm using

Private Sub txtSearch1_Change()
ActiveDocument.Variables("SearchVariable1").Value = txtSearch1.Value
End Sub

to assign the value in the box to a document variable.

And also

Private Sub txtSearch1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
txtSearch1.Text = ""
End Sub

to enable the user to clear the box if necessary.

I'm still looking for some code that will do the other part of my
task:

For each Section in the document,

Seach the text in the Section for the first instance of the contents
of each of the textboxes and set its format to "Bold".

Next section

I'm working on this now, but would appreciate any suggestions you may
have.

TIA

Sophia
 

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