Reply
 
Thread Tools Display Modes
  #1   Report Post  
patricia
 
Posts: n/a
Default Microsoft Word Forms- Yes or NO?

I have created a form in Microsoft Word. Now I have to update it. I need
there to be a question that is simply answered yes or no. Which I can do
using Checkboxes. But what I want to do is if the user answers yes to the
question then another box comes up asking for a particular number. I only
want this to pop up when the user answers yes to Question 1. How do I do
this?




  #2   Report Post  
Charles Kenyon
 
Posts: n/a
Default

I am assuming you mean an "online form" created using the forms toolbar.

If this is correct, you will need an on-exit macro for your checkbox that
checks its status and if the box is checked inserts an additional field is
inserted, possibly a drop down or text field. This requires that the macro
unprotect the form, insert the field, reprotect the form without resetting
the current data, and go to the new field. I have a form that does this. You
could also use an AutoText entry in the form's template for the added field.

The form inserts fields at bookmarks and also for some macros changes the
formatting to cross out text (rather than deleting it outright). See
http://word.mvps.org/FAQs/MacrosVBA/...AtBookmark.htm and
http://word.mvps.org/FAQs/MacrosVBA/...hBookmarks.htm for details on
using bookmarks. The code for the Form is:

Option Explicit
Public sPass As String
' Module and Project Written by Charles Kyle Kenyon
' May 2001, Copyright 2001 All rights reserved

Sub DucesTecum()
'
' DucesTecum Macro
' OnExit macro for DucesTecum Checkbox
' "&chr(10)&"Macro recorded 05/16/2001 by Charles Kyle Kenyon
'
Dim strBringWith As String, rRange As Range
With ActiveDocument
UnProtectSubpoena 'subroutine below
Set rRange = .Bookmarks("YouBringYes").Range
'Save result of form field
strBringWith = .FormFields("BringWhat").Result
If .FormFields("chkDucesTecum").CheckBox.Value _
= True Then
.FormFields("DucesTecumTitle").TextInput.EditType _
Type:=wdRegularText, Default:=" Duces Tecum "
If strBringWith = "" Then strBringWith = _
"Bring what?" 'End If
.FormFields("BringWhat").TextInput.EditType _
Type:=wdRegularText, Default:=strBringWith, _
Enabled:=True
rRange.Font.DoubleStrikeThrough = False
rRange.Font.Bold = True
.FormFields("BringWhat").Select
Else
.FormFields("DucesTecumTitle").TextInput.EditType _
Type:=wdRegularText, Default:=" ", Enabled:=False
.FormFields("BringWhat").TextInput.EditType _
Type:=wdRegularText, Default:="", Enabled:=False
rRange.Font.DoubleStrikeThrough = True
rRange.Font.Bold = False
.FormFields("chkThirdParty").Select
End If
.Protect wdAllowOnlyFormFields, True, sPass
End With
End Sub
Sub ThirdParty()
'
' ThirdParty Macro
' OnExit Macro for Third-Party Checkbox
' "&chr(10)&"Macro written 05/16/2001 by Charles Kyle Kenyon
'
Dim rRange As Range
With ActiveDocument
UnProtectSubpoena 'subroutine below
Set rRange = .Bookmarks("ThirdPartyLanguage").Range
rRange.Font.DoubleStrikeThrough = _
Not .FormFields("chkThirdParty").CheckBox.Value
rRange.Font.Bold = _
.FormFields("chkThirdParty").CheckBox.Value
.Protect wdAllowOnlyFormFields, True, sPass
End With
End Sub

Private Sub UnProtectSubpoena() 'Subroutine for other procedures
With ActiveDocument
sPass = .Variables("FormPassWord")
If .ProtectionType wdNoProtection Then .Unprotect (sPass)
' End If
End With
End Sub

For more about online forms, follow the links at
http://addbalance.com/word/wordwebresources.htm#Forms or
http://word.mvps.org/FAQs/Customizat...nTheBlanks.htm especially Dian
Chapman's series of articles.

If, on the other hand, you are talking about a UserForm or custom dialog
box, you probably want to post your question in the vba.userforms newsgroup.

Hope this helps,
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"patricia" wrote in message
...
I have created a form in Microsoft Word. Now I have to update it. I need
there to be a question that is simply answered yes or no. Which I can do
using Checkboxes. But what I want to do is if the user answers yes to the
question then another box comes up asking for a particular number. I only
want this to pop up when the user answers yes to Question 1. How do I do
this?






  #3   Report Post  
patricia
 
Posts: n/a
Default

This is an online form. Basically what I want to do. I have a question on
my document that says, " Is this facility Provider-Based" Then I have a drop
down menu that has "Yes" or "No". What I want to do is, if , and only if,
the question is answered yes, I want another question to pop up asking for
the Hospital's Provider Number. I do not want this on the document unless
the question is answered with a "Yes". I am pretty familiar with Word, but I
have never created a Micro, so I'm not familiar with "Code Writting". IF you
could help me out with this. I found a Link that helped me out with that,
but it's pretty much a foreign language to me. If you, or a website, could
put this in simplier terms to me, I would appreciate it.


"Charles Kenyon" wrote:

I am assuming you mean an "online form" created using the forms toolbar.

If this is correct, you will need an on-exit macro for your checkbox that
checks its status and if the box is checked inserts an additional field is
inserted, possibly a drop down or text field. This requires that the macro
unprotect the form, insert the field, reprotect the form without resetting
the current data, and go to the new field. I have a form that does this. You
could also use an AutoText entry in the form's template for the added field.

The form inserts fields at bookmarks and also for some macros changes the
formatting to cross out text (rather than deleting it outright). See
http://word.mvps.org/FAQs/MacrosVBA/...AtBookmark.htm and
http://word.mvps.org/FAQs/MacrosVBA/...hBookmarks.htm for details on
using bookmarks. The code for the Form is:

Option Explicit
Public sPass As String
' Module and Project Written by Charles Kyle Kenyon
' May 2001, Copyright 2001 All rights reserved

Sub DucesTecum()
'
' DucesTecum Macro
' OnExit macro for DucesTecum Checkbox
' "&chr(10)&"Macro recorded 05/16/2001 by Charles Kyle Kenyon
'
Dim strBringWith As String, rRange As Range
With ActiveDocument
UnProtectSubpoena 'subroutine below
Set rRange = .Bookmarks("YouBringYes").Range
'Save result of form field
strBringWith = .FormFields("BringWhat").Result
If .FormFields("chkDucesTecum").CheckBox.Value _
= True Then
.FormFields("DucesTecumTitle").TextInput.EditType _
Type:=wdRegularText, Default:=" Duces Tecum "
If strBringWith = "" Then strBringWith = _
"Bring what?" 'End If
.FormFields("BringWhat").TextInput.EditType _
Type:=wdRegularText, Default:=strBringWith, _
Enabled:=True
rRange.Font.DoubleStrikeThrough = False
rRange.Font.Bold = True
.FormFields("BringWhat").Select
Else
.FormFields("DucesTecumTitle").TextInput.EditType _
Type:=wdRegularText, Default:=" ", Enabled:=False
.FormFields("BringWhat").TextInput.EditType _
Type:=wdRegularText, Default:="", Enabled:=False
rRange.Font.DoubleStrikeThrough = True
rRange.Font.Bold = False
.FormFields("chkThirdParty").Select
End If
.Protect wdAllowOnlyFormFields, True, sPass
End With
End Sub
Sub ThirdParty()
'
' ThirdParty Macro
' OnExit Macro for Third-Party Checkbox
' "&chr(10)&"Macro written 05/16/2001 by Charles Kyle Kenyon
'
Dim rRange As Range
With ActiveDocument
UnProtectSubpoena 'subroutine below
Set rRange = .Bookmarks("ThirdPartyLanguage").Range
rRange.Font.DoubleStrikeThrough = _
Not .FormFields("chkThirdParty").CheckBox.Value
rRange.Font.Bold = _
.FormFields("chkThirdParty").CheckBox.Value
.Protect wdAllowOnlyFormFields, True, sPass
End With
End Sub

Private Sub UnProtectSubpoena() 'Subroutine for other procedures
With ActiveDocument
sPass = .Variables("FormPassWord")
If .ProtectionType wdNoProtection Then .Unprotect (sPass)
' End If
End With
End Sub

For more about online forms, follow the links at
http://addbalance.com/word/wordwebresources.htm#Forms or
http://word.mvps.org/FAQs/Customizat...nTheBlanks.htm especially Dian
Chapman's series of articles.

If, on the other hand, you are talking about a UserForm or custom dialog
box, you probably want to post your question in the vba.userforms newsgroup.

Hope this helps,
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"patricia" wrote in message
...
I have created a form in Microsoft Word. Now I have to update it. I need
there to be a question that is simply answered yes or no. Which I can do
using Checkboxes. But what I want to do is if the user answers yes to the
question then another box comes up asking for a particular number. I only
want this to pop up when the user answers yes to Question 1. How do I do
this?







  #4   Report Post  
Charles Kenyon
 
Posts: n/a
Default

The only way to do it is to try. The MVP FAQ has an excellent set of pages
on vba. http://word.mvps.org/FAQs/MacrosVBA.htm I've referred you to a
couple of them already. I got the part of the macro that inserts the field
by recording a macro creating a form field using the forms toolbar. This
doesn't work with a drop-down field. (Recorded macros are a resource for
coding but often give code that isn't as functional as something someone
would write using vba directly; sometimes it is downright screwy.) The
following code inserts a dropdown field at the beginning of the
(unprotected) document. You could have it insert at a bookmark instead (see
pages on dealing with bookmarks).

Dim ffield As FormField
Set ffield = ActiveDocument.FormFields.Add( _
Range:=ActiveDocument.Range(Start:=0, End:=0), _
Type:=wdFieldFormDropDown)
ffield.DropDown.ListEntries.Add "Choice 1"
ffield.DropDown.ListEntries.Add "Choice 2"
ffield.DropDown.ListEntries.Add "Choice 3"
ffield.DropDown.ListEntries.Add "Choice 4"

I don't know how to assign a bookmark name to the field. If this is
important for you, ask in the vba.beginners forum.

While you can spend a lot of time learning to program, you can write useful
macros without a lot of understanding by just playing around. I am still a
beginner. vba is _not_ rocket science but a good understanding of how Word
works helps a lot. Look at the code that is posted on the MVP FAQ site. It
generally has good programming structure.

A long time ago I decided to learn how to use the tools that I work with
daily. I devoted a half-hour per work day to simply learning and trying. (My
time on these newsgroups is now a significant part of that half-hour.)
Within the first month I had more than recovered my time in increased
productivity; I've never looked back.

Start, though, with Dian Chapman's series on forms. Then get into the vba.
If you don't "get" how forms work at the nitty-gritty level, trying to
program them is shooting at a moving target while wearing a blindfold. If
you need a solution yesterday hire someone to do it for you. If you plan on
working with Word over the next five years or so, it is worth your time to
learn how to do it well, though.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"patricia" wrote in message
...
This is an online form. Basically what I want to do. I have a question
on
my document that says, " Is this facility Provider-Based" Then I have a
drop
down menu that has "Yes" or "No". What I want to do is, if , and only if,
the question is answered yes, I want another question to pop up asking for
the Hospital's Provider Number. I do not want this on the document unless
the question is answered with a "Yes". I am pretty familiar with Word,
but I
have never created a Micro, so I'm not familiar with "Code Writting". IF
you
could help me out with this. I found a Link that helped me out with that,
but it's pretty much a foreign language to me. If you, or a website,
could
put this in simplier terms to me, I would appreciate it.


"Charles Kenyon" wrote:

I am assuming you mean an "online form" created using the forms toolbar.

If this is correct, you will need an on-exit macro for your checkbox that
checks its status and if the box is checked inserts an additional field
is
inserted, possibly a drop down or text field. This requires that the
macro
unprotect the form, insert the field, reprotect the form without
resetting
the current data, and go to the new field. I have a form that does this.
You
could also use an AutoText entry in the form's template for the added
field.

The form inserts fields at bookmarks and also for some macros changes the
formatting to cross out text (rather than deleting it outright). See
http://word.mvps.org/FAQs/MacrosVBA/...AtBookmark.htm and
http://word.mvps.org/FAQs/MacrosVBA/...hBookmarks.htm for details on
using bookmarks. The code for the Form is:

Option Explicit
Public sPass As String
' Module and Project Written by Charles Kyle Kenyon
' May 2001, Copyright 2001 All rights reserved

Sub DucesTecum()
'
' DucesTecum Macro
' OnExit macro for DucesTecum Checkbox
' "&chr(10)&"Macro recorded 05/16/2001 by Charles Kyle Kenyon
'
Dim strBringWith As String, rRange As Range
With ActiveDocument
UnProtectSubpoena 'subroutine below
Set rRange = .Bookmarks("YouBringYes").Range
'Save result of form field
strBringWith = .FormFields("BringWhat").Result
If .FormFields("chkDucesTecum").CheckBox.Value _
= True Then
.FormFields("DucesTecumTitle").TextInput.EditType _
Type:=wdRegularText, Default:=" Duces Tecum "
If strBringWith = "" Then strBringWith = _
"Bring what?" 'End If
.FormFields("BringWhat").TextInput.EditType _
Type:=wdRegularText, Default:=strBringWith, _
Enabled:=True
rRange.Font.DoubleStrikeThrough = False
rRange.Font.Bold = True
.FormFields("BringWhat").Select
Else
.FormFields("DucesTecumTitle").TextInput.EditType _
Type:=wdRegularText, Default:=" ", Enabled:=False
.FormFields("BringWhat").TextInput.EditType _
Type:=wdRegularText, Default:="", Enabled:=False
rRange.Font.DoubleStrikeThrough = True
rRange.Font.Bold = False
.FormFields("chkThirdParty").Select
End If
.Protect wdAllowOnlyFormFields, True, sPass
End With
End Sub
Sub ThirdParty()
'
' ThirdParty Macro
' OnExit Macro for Third-Party Checkbox
' "&chr(10)&"Macro written 05/16/2001 by Charles Kyle Kenyon
'
Dim rRange As Range
With ActiveDocument
UnProtectSubpoena 'subroutine below
Set rRange = .Bookmarks("ThirdPartyLanguage").Range
rRange.Font.DoubleStrikeThrough = _
Not .FormFields("chkThirdParty").CheckBox.Value
rRange.Font.Bold = _
.FormFields("chkThirdParty").CheckBox.Value
.Protect wdAllowOnlyFormFields, True, sPass
End With
End Sub

Private Sub UnProtectSubpoena() 'Subroutine for other procedures
With ActiveDocument
sPass = .Variables("FormPassWord")
If .ProtectionType wdNoProtection Then .Unprotect (sPass)
' End If
End With
End Sub

For more about online forms, follow the links at
http://addbalance.com/word/wordwebresources.htm#Forms or
http://word.mvps.org/FAQs/Customizat...nTheBlanks.htm especially
Dian
Chapman's series of articles.

If, on the other hand, you are talking about a UserForm or custom dialog
box, you probably want to post your question in the vba.userforms
newsgroup.

Hope this helps,
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"patricia" wrote in message
...
I have created a form in Microsoft Word. Now I have to update it. I
need
there to be a question that is simply answered yes or no. Which I can
do
using Checkboxes. But what I want to do is if the user answers yes to
the
question then another box comes up asking for a particular number. I
only
want this to pop up when the user answers yes to Question 1. How do I
do
this?









  #5   Report Post  
patricia
 
Posts: n/a
Default

Thank you so much. The information that you have given me has helped a great
deal. I am an administrative assistant and the job that I currently hold,
along with jobs that I hope to obtain in the future, requires me to be
familiar with Word along with a few other programs. It is in my best
interest to sit down and take the time to learn this information. I do, once
again, thank you for your help.



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
How can I divide a page into three sections? Bonnie Microsoft Word Help 3 May 8th 23 02:47 AM
Microsoft Word Forms patricia Microsoft Word Help 1 December 21st 04 11:08 PM
You cannot quit Microsoft Word because a dialog is active Fairlane Microsoft Word Help 1 December 12th 04 01:28 AM
saving the workspace Mike Microsoft Word Help 3 December 8th 04 11:32 PM
How do I convert a cd in word perfect to microsoft word greylady Microsoft Word Help 1 November 23rd 04 07:03 PM


All times are GMT +1. The time now is 06:36 PM.

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"