Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Skrewdriver1979 Skrewdriver1979 is offline
external usenet poster
 
Posts: 9
Default Hide/Show Text Form View

This place has been amazing for help. So I am on to my next challenge.
Basically in a locked form view, an agent selects whether it is an eligible
claim, customer and/or product in check boxes. My goal is to make it look
like this:

ELIGIBLE CLAIM: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE CUSTOMER: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE PRODUCT: Yes (CheckBox) No (CheckBox) Show/Hide

Is there a way to show/hide information, such as stipulations to clarify why
they are or are not by clicking a 'show/hide' of sorts in a locked form?

ELIGIBLE CLAIM: Yes (CheckBox) No (CheckBox) Show/Hide
Claims must be based on an alleged defect in the material or workmanship
that is covered by the Limited Warranty.
ELIGIBLE CUSTOMER: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE PRODUCT: Yes (CheckBox) No (CheckBox) Show/Hide

The eligibility is quite lengthy which is why I want to show/hide the
information. (the examples are just examples). The real catch is, the
eligiblity information varies location to location. I have a drop down to
select location which macro adds the eligibility information with a formfield
when the string is longer then 256 characters.

ActiveDocument.Unprotect
ActiveDocument.Bookmarks("Text1").Range.Fields(1). Result.Text = Str1
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Does any of this make sence? Or even possible in a locked form?

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Hide/Show Text Form View

You could run a macro on exit from the checkbox field (here Check1) to write
the required text to a bookmark location (here Check1Result) in the document
eg

Sub Checked1()
Dim oFld As FormFields
Dim rText As Range
Dim bProtected As Boolean
'Unprotect the file
If ActiveDocument.ProtectionType wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If
Set oFld = ActiveDocument.FormFields
Set rText = ActiveDocument.Bookmarks("Check1Result").Range

If oFld("Check1").CheckBox.Value = True Then
rText.Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
" & _
"sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
" & _
"erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
" & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat." _
& vbCr & _
"Ut wisi enim ad minim veniam, quis nostrud exerci tation " & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse "
& _
"molestie consequat, vel illum dolore eu feugiat nulla facilisis at " &
_
"vero eros et accumsan et iusto odio dignissim qui blandit praesent " &
_
"luptatum zzril delenit augue duis dolore te feugait nulla facilisi. " &
_
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat."
Else
rText.Text = "This is the text to use when the box is un-checked"
End If

With ActiveDocument
.Bookmarks.Add "Check1Result", rText
.Fields.Update
End With

CleanUp:
'Goto the next field - here check box 2
Selection.GoTo What:=wdGoToBookmark, name:="Check2"
'Reprotect the document.
Finished:
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
End Sub

If you want to show or hide the text and retain the space it occupied then
instead of inserting a zero length text string you can format the text
string as white colour which will make it 'invisible'. e.g.

Sub Checked1A()
Dim oFld As FormFields
Dim rText As Range
Dim sText As String
Dim bProtected As Boolean

sText = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, " & _
"sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
" & _
"erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
" & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat." _
& vbCr & _
"Ut wisi enim ad minim veniam, quis nostrud exerci tation " & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse "
& _
"molestie consequat, vel illum dolore eu feugiat nulla facilisis at " &
_
"vero eros et accumsan et iusto odio dignissim qui blandit praesent " &
_
"luptatum zzril delenit augue duis dolore te feugait nulla facilisi. " &
_
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat."

'Unprotect the file
If ActiveDocument.ProtectionType wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If
Set oFld = ActiveDocument.FormFields
Set rText = ActiveDocument.Bookmarks("Check1Result").Range
rText.Text = sText

If oFld("Check1").CheckBox.Value = True Then
rText.Font.Color = wdColorBlack
Else
rText.Font.Color = wdColorWhite
End If

With ActiveDocument
.Bookmarks.Add "Check1Result", rText
.Fields.Update
End With

CleanUp:
'Goto the next field - here check box 2
Selection.GoTo What:=wdGoToBookmark, name:="Check2"
'Reprotect the document.
Finished:
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
End Sub


--

Graham Mayor - Word MVP

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



Skrewdriver1979 wrote:
This place has been amazing for help. So I am on to my next challenge.
Basically in a locked form view, an agent selects whether it is an
eligible claim, customer and/or product in check boxes. My goal is to
make it look like this:

ELIGIBLE CLAIM: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE CUSTOMER: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE PRODUCT: Yes (CheckBox) No (CheckBox) Show/Hide

Is there a way to show/hide information, such as stipulations to
clarify why they are or are not by clicking a 'show/hide' of sorts in
a locked form?

ELIGIBLE CLAIM: Yes (CheckBox) No (CheckBox) Show/Hide
Claims must be based on an alleged defect in the material or
workmanship that is covered by the Limited Warranty.
ELIGIBLE CUSTOMER: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE PRODUCT: Yes (CheckBox) No (CheckBox) Show/Hide

The eligibility is quite lengthy which is why I want to show/hide the
information. (the examples are just examples). The real catch is, the
eligiblity information varies location to location. I have a drop
down to select location which macro adds the eligibility information
with a formfield when the string is longer then 256 characters.

ActiveDocument.Unprotect
ActiveDocument.Bookmarks("Text1").Range.Fields(1). Result.Text = Str1
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Does any of this make sence? Or even possible in a locked form?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Skrewdriver1979 Skrewdriver1979 is offline
external usenet poster
 
Posts: 9
Default Hide/Show Text Form View

I was having trouble with this. Kept getting an error to do with missing a
bookmark. However, from what I was able to get to work I think that I am
looking for something a little different. Where a macro on exit from check1
will show/hide a (Text Form Field) Text1 while the doc is locked.

"Graham Mayor" wrote:

You could run a macro on exit from the checkbox field (here Check1) to write
the required text to a bookmark location (here Check1Result) in the document
eg

Sub Checked1()
Dim oFld As FormFields
Dim rText As Range
Dim bProtected As Boolean
'Unprotect the file
If ActiveDocument.ProtectionType wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If
Set oFld = ActiveDocument.FormFields
Set rText = ActiveDocument.Bookmarks("Check1Result").Range

If oFld("Check1").CheckBox.Value = True Then
rText.Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
" & _
"sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
" & _
"erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
" & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat." _
& vbCr & _
"Ut wisi enim ad minim veniam, quis nostrud exerci tation " & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse "
& _
"molestie consequat, vel illum dolore eu feugiat nulla facilisis at " &
_
"vero eros et accumsan et iusto odio dignissim qui blandit praesent " &
_
"luptatum zzril delenit augue duis dolore te feugait nulla facilisi. " &
_
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat."
Else
rText.Text = "This is the text to use when the box is un-checked"
End If

With ActiveDocument
.Bookmarks.Add "Check1Result", rText
.Fields.Update
End With

CleanUp:
'Goto the next field - here check box 2
Selection.GoTo What:=wdGoToBookmark, name:="Check2"
'Reprotect the document.
Finished:
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
End Sub

If you want to show or hide the text and retain the space it occupied then
instead of inserting a zero length text string you can format the text
string as white colour which will make it 'invisible'. e.g.

Sub Checked1A()
Dim oFld As FormFields
Dim rText As Range
Dim sText As String
Dim bProtected As Boolean

sText = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, " & _
"sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
" & _
"erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
" & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat." _
& vbCr & _
"Ut wisi enim ad minim veniam, quis nostrud exerci tation " & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
" & _
"Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse "
& _
"molestie consequat, vel illum dolore eu feugiat nulla facilisis at " &
_
"vero eros et accumsan et iusto odio dignissim qui blandit praesent " &
_
"luptatum zzril delenit augue duis dolore te feugait nulla facilisi. " &
_
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " &
_
"nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat."

'Unprotect the file
If ActiveDocument.ProtectionType wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If
Set oFld = ActiveDocument.FormFields
Set rText = ActiveDocument.Bookmarks("Check1Result").Range
rText.Text = sText

If oFld("Check1").CheckBox.Value = True Then
rText.Font.Color = wdColorBlack
Else
rText.Font.Color = wdColorWhite
End If

With ActiveDocument
.Bookmarks.Add "Check1Result", rText
.Fields.Update
End With

CleanUp:
'Goto the next field - here check box 2
Selection.GoTo What:=wdGoToBookmark, name:="Check2"
'Reprotect the document.
Finished:
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
End Sub


--

Graham Mayor - Word MVP

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



Skrewdriver1979 wrote:
This place has been amazing for help. So I am on to my next challenge.
Basically in a locked form view, an agent selects whether it is an
eligible claim, customer and/or product in check boxes. My goal is to
make it look like this:

ELIGIBLE CLAIM: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE CUSTOMER: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE PRODUCT: Yes (CheckBox) No (CheckBox) Show/Hide

Is there a way to show/hide information, such as stipulations to
clarify why they are or are not by clicking a 'show/hide' of sorts in
a locked form?

ELIGIBLE CLAIM: Yes (CheckBox) No (CheckBox) Show/Hide
Claims must be based on an alleged defect in the material or
workmanship that is covered by the Limited Warranty.
ELIGIBLE CUSTOMER: Yes (CheckBox) No (CheckBox) Show/Hide
ELIGIBLE PRODUCT: Yes (CheckBox) No (CheckBox) Show/Hide

The eligibility is quite lengthy which is why I want to show/hide the
information. (the examples are just examples). The real catch is, the
eligiblity information varies location to location. I have a drop
down to select location which macro adds the eligibility information
with a formfield when the string is longer then 256 characters.

ActiveDocument.Unprotect
ActiveDocument.Bookmarks("Text1").Range.Fields(1). Result.Text = Str1
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Does any of this make sence? Or even possible in a locked form?




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
Show, Hide & Repeat Sections of a form KimC Microsoft Word Help 3 June 3rd 08 10:53 AM
Show/Hide and Hidden Text Michelle Microsoft Word Help 1 September 27th 07 07:17 PM
How can I set an automated form to show/hide a section? Natalie W.[_2_] Microsoft Word Help 11 May 16th 07 01:59 AM
Show/Hide Text Matthew256 Page Layout 1 January 26th 07 10:46 AM
Show/Hide text Susan New Users 2 December 1st 04 05:49 PM


All times are GMT +1. The time now is 04:19 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"