Group:  Microsoft Word ยป microsoft.public.word.vba.userforms
Thread: option button to show text

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

option button to show text
yossisp[ at ]nice.com 11.07.2006 14:35:30
Hi,

I am trying to create two option buttons on a user form in word VBA
that when one selected a certain text will appear in the document and a
different text will appear when the second option button is selected.
The text itself is long with screen shots.

Any suggestions?

Thanks,

Re: option button to show text
"Greg Maxey" <gmaxey[ at ]mvps.org> 11.07.2006 14:46:16
You could create an AutoText entry containing your long string w/screen
shots and then insert the AutoText entry at a bookmark in the document
when the option button is clicked.

Something like:

Private Sub OptionButton1_Click()
ActiveDocument.AttachedTemplate.AutoTextEntries("Test").Insert _
Where:=ActiveDocument.Bookmarks("Test").Range, RichText:=True
End Sub

This could get a bit messy if the user can click one option then
another etc. You might want to use a command button that inserts the
AutoText entry and "closes" the form so the user can't change between
the two.

yoss...[ at ]nice.com wrote:
[Quoted Text]
> Hi,
>
> I am trying to create two option buttons on a user form in word VBA
> that when one selected a certain text will appear in the document and a
> different text will appear when the second option button is selected.
> The text itself is long with screen shots.
>
> Any suggestions?
>
> Thanks,

Re: option button to show text
"vandaley" <yossisp[ at ]nice.com> 11.07.2006 15:20:18

Greg Maxey wrote:
[Quoted Text]
> You could create an AutoText entry containing your long string w/screen
> shots and then insert the AutoText entry at a bookmark in the document
> when the option button is clicked.
>
> Something like:
>
> Private Sub OptionButton1_Click()
> ActiveDocument.AttachedTemplate.AutoTextEntries("Test").Insert _
> Where:=ActiveDocument.Bookmarks("Test").Range, RichText:=True
> End Sub
>
> This could get a bit messy if the user can click one option then
> another etc. You might want to use a command button that inserts the
> AutoText entry and "closes" the form so the user can't change between
> the two.
>
> yoss...[ at ]nice.com wrote:
> > Hi,
> >
> > I am trying to create two option buttons on a user form in word VBA
> > that when one selected a certain text will appear in the document and a
> > different text will appear when the second option button is selected.
> > The text itself is long with screen shots.
> >
> > Any suggestions?
> >
> > Thanks,

Looks like the screen shot didnt get in, it says "Error! Objects cannot
be created from editing field codes." after i click the option button.
Can i delete the string after added to the auto text, after all i want
it to be added only after the option button is selected.

Thanks,

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net