Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Each of the list below from a protected form will have a checkbox beside it.
How do I make it so that when the checkbox is left unticked that the corresponding item will be strikethrough? PASSENGER SHIP PASSENGER HIGH-SPEED CRAFT CARGO HIGH-SPEED CRAFT BULK CARRIER OIL TANKER CHEMICAL TANKER GAS CARRIER MOBILE OFFSHORE DRILLING UNIT OTHER CARGO SHIP (N/A) Many thanks |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
So what you need is a Marco the first unprotect the documents, changes
the font to strike out and then re-protects it, and then assigns this Marco to the OnExit on the check box properties. Step 1: Unprotect the document: ActiveDocument.Unprotect Password: ="place password here" Step 2: Selecting the front to change - I would make the text you want changed into a bookmark, it makes life a lot easer Sub Macro7() If ActiveDocument.FormFields("Check1").CheckBox = True Then ActiveDocument.Bookmarks("Bookmarkhere").Select Selection.Font.StrikeThrough = True Else ActiveDocument.Bookmarks("Bookmarkhere").Select Selection.Font.StrikeThrough = False End If End Sub The above code basically checks to see if the check box is checked if it is then it selects the bookmark and changes the font to StrikeThrough as true. If the user uncheck the box it will return to normal. Step 3: Re-protecting the document ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _ Password: ="password" This way the user will never know that the doc was unprotected. If you have any other question just let me know ~Amanda~ |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Thanks very much for that.
Unfortunately I'm a total beginner at this. The code I've got input into Visual Basic is: Sub Strikethrough() ' ' Strikethrough Macro ' Macro recorded 7/19/2006 by planap ' Sub Macro7() ActiveDocument.Unprotect Password:="1964" End Sub Sub Macro7() If ActiveDocument.FormFields("Check1").CheckBox = True Then ActiveDocument.Bookmarks("Text13").Select Selection.Font.Strikethrough = True Else ActiveDocument.Bookmarks("Text13").Select Selection.Font.Strikethrough = False End If End Sub Sub Macro7() ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _ Password:="1964" End Sub Do I add the macro on exit only? To the checkbox field or the text13 field? Many thanks "AmandaH" wrote: So what you need is a Marco the first unprotect the documents, changes the font to strike out and then re-protects it, and then assigns this Marco to the OnExit on the check box properties. Step 1: Unprotect the document: ActiveDocument.Unprotect Password: ="place password here" Step 2: Selecting the front to change - I would make the text you want changed into a bookmark, it makes life a lot easer Sub Macro7() If ActiveDocument.FormFields("Check1").CheckBox = True Then ActiveDocument.Bookmarks("Bookmarkhere").Select Selection.Font.StrikeThrough = True Else ActiveDocument.Bookmarks("Bookmarkhere").Select Selection.Font.StrikeThrough = False End If End Sub The above code basically checks to see if the check box is checked if it is then it selects the bookmark and changes the font to StrikeThrough as true. If the user uncheck the box it will return to normal. Step 3: Re-protecting the document ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _ Password: ="password" This way the user will never know that the doc was unprotected. If you have any other question just let me know ~Amanda~ |
#4
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Ok so I fixed some of the code below, you can do it all in one sub.
So when you right click on the check box you will see the properties option. In that dialog box you will see the title "Run Marco on". Select "Exit:" drop down box and find your Marco in this case Macro7, then click OK, it should work fine. Then for all Check boxes that you want to use this code for you need to add a separate bookmark to the text and revise the code. So in the end you are going to have 6 (I think) different Marcos. Or 1 Marco for 1 Check box. I know it is a little redundant, But hey its VBA not Java. lol nat_h45 wrote: Thanks very much for that. Unfortunately I'm a total beginner at this. The code I've got input into Visual Basic is: Sub Strikethrough() ' ' Strikethrough Macro ' Macro recorded 7/19/2006 by planap ' ActiveDocument.Unprotect Password:="1964" If ActiveDocument.FormFields("Check1").CheckBox.value = false Then ActiveDocument.Bookmarks("Text13").Select Selection.Font.Strikethrough = True Elseif ActiveDocument.FormFields("Check1").CheckBox.value = true ActiveDocument.Bookmarks("Text13").Select Selection.Font.Strikethrough = False End If ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _ Password:="1964" End Sub Do I add the macro on exit only? To the checkbox field or the text13 field? Many thanks "AmandaH" wrote: So what you need is a Marco the first unprotect the documents, changes the font to strike out and then re-protects it, and then assigns this Marco to the OnExit on the check box properties. Step 1: Unprotect the document: ActiveDocument.Unprotect Password: ="place password here" Step 2: Selecting the front to change - I would make the text you want changed into a bookmark, it makes life a lot easer Sub Macro7() If ActiveDocument.FormFields("Check1").CheckBox = True Then ActiveDocument.Bookmarks("Bookmarkhere").Select Selection.Font.StrikeThrough = True Else ActiveDocument.Bookmarks("Bookmarkhere").Select Selection.Font.StrikeThrough = False End If End Sub The above code basically checks to see if the check box is checked if it is then it selects the bookmark and changes the font to StrikeThrough as true. If the user uncheck the box it will return to normal. Step 3: Re-protecting the document ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _ Password: ="password" This way the user will never know that the doc was unprotected. If you have any other question just let me know ~Amanda~ |
#5
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
What follows is an on-exit macro for the checkbox named chkThirdParty. It
changes both the bold and the double-strikethrough features of bookmarked text. 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 If the box is checked, it undoes the double-strikethrough and bolds the text, otherwise it is stricken and not bold. It might be possible to do this with an IF field without a macro, but I'm not sure how. Hope this is helpful. -- 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://word.mvps.org/FAQs/ which is awesome! My criminal defense site: http://addbalance.com --------- --------- --------- --------- --------- --------- 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. "nat_h45" wrote in message ... Each of the list below from a protected form will have a checkbox beside it. How do I make it so that when the checkbox is left unticked that the corresponding item will be strikethrough? PASSENGER SHIP PASSENGER HIGH-SPEED CRAFT CARGO HIGH-SPEED CRAFT BULK CARRIER OIL TANKER CHEMICAL TANKER GAS CARRIER MOBILE OFFSHORE DRILLING UNIT OTHER CARGO SHIP (N/A) Many thanks |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I set up condional formatting in locked word forms? | Microsoft Word Help | |||
Clearing formatting in Word 2003 | Microsoft Word Help | |||
Formatting text in forms | Microsoft Word Help | |||
Forms Development in Word | Microsoft Word Help | |||
Word Forms Formatting | Microsoft Word Help |