Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
tligett
 
Posts: n/a
Default How to create 'command buttons' to hide/reveal text in Word?

I am needing to insert buttons that answer questions in a Word document
already heaviy ladden with macros. The yes/no answers need to create a
reaction where designated text is hidden dependent on the answer to the
question. I am told to use Visual Basic Editor but am having a hard time
setting the document up. What do I do?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default How to create 'command buttons' to hide/reveal text in Word?

My old pal and fellow MVP Greg Maxey did some work on this a while back. See
if there is anything on his web site that would help.
http://gregmaxey.mvps.org/
I am working off line at the moment and have cleared my internet cache so
you can check just as quickly as I can

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


tligett wrote:
I am needing to insert buttons that answer questions in a Word
document already heaviy ladden with macros. The yes/no answers need
to create a reaction where designated text is hidden dependent on the
answer to the question. I am told to use Visual Basic Editor but am
having a hard time setting the document up. What do I do?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default How to create 'command buttons' to hide/reveal text in Word?

See http://gregmaxey.mvps.org/Toggle_Data_Display.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Graham Mayor wrote:
My old pal and fellow MVP Greg Maxey did some work on this a while
back. See if there is anything on his web site that would help.
http://gregmaxey.mvps.org/
I am working off line at the moment and have cleared my internet
cache so you can check just as quickly as I can


tligett wrote:
I am needing to insert buttons that answer questions in a Word
document already heaviy ladden with macros. The yes/no answers need
to create a reaction where designated text is hidden dependent on the
answer to the question. I am told to use Visual Basic Editor but am
having a hard time setting the document up. What do I do?



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Paul Bishop
 
Posts: n/a
Default How to create 'command buttons' to hide/reveal text in Word?

Yes, but would you recommend this approach if the text to be hidden were a
whole paragraph, itself containing several form fields?
--
Paul Bishop


"Graham Mayor" wrote:

See http://gregmaxey.mvps.org/Toggle_Data_Display.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Graham Mayor wrote:
My old pal and fellow MVP Greg Maxey did some work on this a while
back. See if there is anything on his web site that would help.
http://gregmaxey.mvps.org/
I am working off line at the moment and have cleared my internet
cache so you can check just as quickly as I can


tligett wrote:
I am needing to insert buttons that answer questions in a Word
document already heaviy ladden with macros. The yes/no answers need
to create a reaction where designated text is hidden dependent on the
answer to the question. I am told to use Visual Basic Editor but am
having a hard time setting the document up. What do I do?




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default How to create 'command buttons' to hide/reveal text in Word?

No you can't do that. You'll have to rethink the whole form in order to do
this. You can insert texts based upon the result of a form field eg
http://www.gmayor.com/SelectFile.htm but extra form fields are a different
matter. I would personally approach this using userforms and macros to call
further userforms based on the responses to create the finished document.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Paul Bishop wrote:
Yes, but would you recommend this approach if the text to be hidden
were a whole paragraph, itself containing several form fields?

See http://gregmaxey.mvps.org/Toggle_Data_Display.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Graham Mayor wrote:
My old pal and fellow MVP Greg Maxey did some work on this a while
back. See if there is anything on his web site that would help.
http://gregmaxey.mvps.org/
I am working off line at the moment and have cleared my internet
cache so you can check just as quickly as I can


tligett wrote:
I am needing to insert buttons that answer questions in a Word
document already heaviy ladden with macros. The yes/no answers
need to create a reaction where designated text is hidden
dependent on the answer to the question. I am told to use Visual
Basic Editor but am having a hard time setting the document up.
What do I do?





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Paul Bishop
 
Posts: n/a
Default How to create 'command buttons' to hide/reveal text in Word?

Thanks. I managed to run the example at
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

My users will have multiple data items from the left side, right side, both
or neither. I suppose that if I put all the relevant text and combo boxes
into a userform, on returning I can populate the two [sets of] bookmarks in
the document appropriately. It would be nice, if the user realises that he
has made a mistake, for him to be able to return to the userform and edit the
data fora second pass.
--
Paul Bishop


"Graham Mayor" wrote:

No you can't do that. You'll have to rethink the whole form in order to do
this. You can insert texts based upon the result of a form field eg
http://www.gmayor.com/SelectFile.htm but extra form fields are a different
matter. I would personally approach this using userforms and macros to call
further userforms based on the responses to create the finished document.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Paul Bishop wrote:
Yes, but would you recommend this approach if the text to be hidden
were a whole paragraph, itself containing several form fields?

See http://gregmaxey.mvps.org/Toggle_Data_Display.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Graham Mayor wrote:
My old pal and fellow MVP Greg Maxey did some work on this a while
back. See if there is anything on his web site that would help.
http://gregmaxey.mvps.org/
I am working off line at the moment and have cleared my internet
cache so you can check just as quickly as I can


tligett wrote:
I am needing to insert buttons that answer questions in a Word
document already heaviy ladden with macros. The yes/no answers
need to create a reaction where designated text is hidden
dependent on the answer to the question. I am told to use Visual
Basic Editor but am having a hard time setting the document up.
What do I do?




  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman
 
Posts: n/a
Default How to create 'command buttons' to hide/reveal text in Word?

Hi Paul,

To initialize the controls of the userform to values in the bookmarks
to enable editing of previous entries, you need to grab those values
as the userform is preparing its appearance.

In the userform's code window in the VBA editor, there are two
dropdowns just below the toolbars. In the left dropdown, choose
"UserForm"; then in the right dropdown, choose "Activate". That
prepares this empty subroutine:

Private Sub UserForm_Activate()

End Sub

Between those lines, you can write code that will initialize the
contents of the text and combo boxes of the userform with whatever
values are in the bookmarks in the document. Here is sample code:

Private Sub UserForm_Activate()
Dim Depts As Variant
Dim strDept As String
Depts = Array("Sales", "Production", "Acquisitions")

' fill in text box
txtName.Text = _
ActiveDocument.Bookmarks("Name").Range.Text

' initialize combo box list and select value
With cbxDept
.Clear
.List = Depts
strDept = _
ActiveDocument.Bookmarks("Department").Range.Text
.Value = strDept
If Not .MatchFound Then
MsgBox "Invalid department " & strDept, _
vbOKOnly + vbCritical, "Error"
End If
End With
End Sub

Real working code should take into account the possibilities that the
bookmarks don't exist (the user deleted them or overwrote them) or
contain either nothing or invalid values.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 18 Feb 2006 10:36:26 -0800, "Paul Bishop"
wrote:

Thanks. I managed to run the example at
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

My users will have multiple data items from the left side, right side, both
or neither. I suppose that if I put all the relevant text and combo boxes
into a userform, on returning I can populate the two [sets of] bookmarks in
the document appropriately. It would be nice, if the user realises that he
has made a mistake, for him to be able to return to the userform and edit the
data fora second pass.
--
Paul Bishop


"Graham Mayor" wrote:

No you can't do that. You'll have to rethink the whole form in order to do
this. You can insert texts based upon the result of a form field eg
http://www.gmayor.com/SelectFile.htm but extra form fields are a different
matter. I would personally approach this using userforms and macros to call
further userforms based on the responses to create the finished document.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Paul Bishop wrote:
Yes, but would you recommend this approach if the text to be hidden
were a whole paragraph, itself containing several form fields?

See http://gregmaxey.mvps.org/Toggle_Data_Display.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Graham Mayor wrote:
My old pal and fellow MVP Greg Maxey did some work on this a while
back. See if there is anything on his web site that would help.
http://gregmaxey.mvps.org/
I am working off line at the moment and have cleared my internet
cache so you can check just as quickly as I can


tligett wrote:
I am needing to insert buttons that answer questions in a Word
document already heaviy ladden with macros. The yes/no answers
need to create a reaction where designated text is hidden
dependent on the answer to the question. I am told to use Visual
Basic Editor but am having a hard time setting the document up.
What do I do?




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
take yet another lesson from wordperfect "reveal codes" wordperfect is superior Microsoft Word Help 5 May 11th 09 07:58 PM
In Word, how do I surpress headers and footers on page 2 Bill Microsoft Word Help 1 December 15th 05 06:13 PM
keep text together New2Word Microsoft Word Help 4 November 16th 05 01:39 AM
How do I set right and left alignment on the same line in Word? Matador Page Layout 1 November 9th 05 08:32 PM
In Word, how can I see all files (*.*) in "save as"? citizen53 New Users 8 April 4th 05 04:56 PM


All times are GMT +1. The time now is 03:46 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"