![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
Hello
In MS Excel it is easy to reference the contents of one cell to that of a secone cell by entering the "=" sign, referencing the first cell and then pressing enter. However, how the hell do you do something similar in MS Word 2010? I am trying to set up an MS Word web based application form (hopefully using the Form fields in Word then protecting via PDF) to capture initial information. Then, later on a second page, I wish to reference that primary information from the first page without having to manually do it. How the heck is something like this done on MS Word 2010? Kind regards and in anticipation Wade |
#2
|
|||
|
|||
![]()
There are a bunch of ways. I recommend reading through all of the following article to pick the one that will work best for you.
Repeating Data (Populating Multiple Like Fields) |
#3
|
|||
|
|||
![]()
Thanks Charles.
|
#4
|
|||
|
|||
![]()
You are welcome.
|
#5
|
|||
|
|||
![]()
Hi Charles
Thanks again for the previous assitance. I am now gearing up further in my form development - and am stuck! I am wanting to use a drop down field to pick a pre-select number of possible replies. Depending upon which reply is chosen the form may then need to add new text AND a particular Form Field to be 'created automatically', if this makes sense? I want to then use the information supplied from this 'automatic selction' later on in the form (using Ref, or something else?). How does one go about this? Is this beyond MS Word Form, and if so would I need to utilise other tools to do this? Please find attached a 'mud-map' of what I tried to explain above. It may be of assistance? Maybe not! The issues that I see as a challenge for me are how to set Bookmarks to unseen Text and/or Form Fields on a Form then somehow Ref these fields later on in the form. Makse sense? Your help is greatly appreciated. Kind regards and in anticipation, Wade |
#6
|
|||
|
|||
![]()
Wade, this is much more challenging than your last question. There are two difficult questions. The first is how to have your form, itself, change based on whether or not a particular answer is picked in a drop down. The second is how to reference a formfield that may or maynot exist.
Let me deal with the first question. What follows is code that I have used for more than 10 years with a legacy form. It inserts a formfield at a bookmark if a checkbox is checked. You should be able to adapt it to a particular drop-down choice. Note this was written for (and works with) legacy form fields in a form protected for filling in forms with a password. If you are selling this, write to discuss a commission. Code:
Public sPass ' Module and Project Written by Charles Kyle Kenyon ' May 2001, Copyright 2001 All rights reserved Sub AutoNew() AutoOpen End Sub Sub AutoOpen() SetDocumentVariablePassword sPass = ActiveDocument.Variables("FormPassWord") LockDocForForms 'Lock this form so formfields will work GoToStartingField 'If set for particular case, goto witness info End Sub Private Sub LockDocForForms() 'Locks Document or Template for Forms upon opening or creation If ActiveDocument.ProtectionType <> wdAllowOnlyFormFields Then ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _ NoReset:=True, Password:=sPass End If End Sub Private Sub GoToStartingField() ' Checks to see if form has been modified for a particular _ defendant. If it has, then start with Witness name, _ otherwise, start with County name If ActiveDocument.FormFields("DefName").Result = "DEFENDANT'S NAME?" Then ActiveDocument.FormFields("County").Select Else ActiveDocument.FormFields("WitName").Select End If End Sub Private Sub SetDocumentVariablePassword() Dim num As Integer, aVar As Variable For Each aVar In ActiveDocument.Variables If aVar.Name = "FormPassWord" Then num = aVar.Index 'End If Next aVar If num = 0 Then ActiveDocument.Variables.Add Name:="FormPassWord", Value:="GF126" Else ActiveDocument.Variables(num).Value = "GF126" End If End Sub Public Sub ProtectSubpoenaForForms() On Error GoTo NotSubpoena With ActiveDocument sPass = .Variables("FormPassWord") 'will trip error message if not set If .ProtectionType = wdNoProtection Then .Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=sPass ' End If End With On Error GoTo 0 End NotSubpoena: MsgBox "This is not a subpoena form based on the right template!", vbExclamation, "Oh! Oh! Wrong Document for this macro!" End Sub Sub DucesTecum() ' ' DucesTecum Macro ' OnExit macro for DucesTecum Checkbox ' "&chr(10)&"Macro written 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 Sub UnprotectSubpoenaForm() 'For Menu MsgBox "The password to unprotect this document is " _ & ActiveDocument.Variables("FormPassWord") & "." & vbCrLf _ & "You must use the same password if you reprotect it, otherwise the form will not work. Please write it down.", vbExclamation, "Subpoena Form Password Information" UnProtectSubpoena 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 |
#7
|
|||
|
|||
![]()
Hi Charles
Thanks for the code, but my coding experience is limited. I did some coding using a Pascal type language many years ago, but as much as I would like to learn the new syntax here my time is also limited. I will take a step back and make the form simpler without as much 'smarts', so to speak. Thanks for your help thus far. Kind regards Wade |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rocketbeta | Word | 1 | 08-21-2012 02:54 PM |
![]() |
kg28 | Word | 1 | 02-04-2012 01:33 PM |
PP hangs" "contacting the server for information" | Mr_Canoehead | PowerPoint | 2 | 08-20-2011 07:58 PM |
![]() |
Jamal NUMAN | Word | 2 | 07-03-2011 03:11 AM |
![]() |
Learner7 | Excel | 1 | 04-25-2011 04:39 AM |