![]() |
#1
|
|||
|
|||
![]()
Hello everyone,
Apparently this is a known problem? String too long while renaming formfields. Background: I have many forms which have been filled out by users, however the form design was shoddy and the fields were not properly bookmarked. I need to rename the fields/bookmarks to enable uploading the field data into an access database. The form fields are all set to unlimited text. However when using the following function, I am getting a string too long error. The fix documented at http://word.mvps.org/FAQs/MacrosVBA/...mFldResult.htm doesnt work for me. I've attached a sample file with the function below installed in the vba section. Can someone assist me with getting the function working. thanks Option Explicit Sub RenameFormFields() Dim oFrmFlds As FormFields Dim pIndex As Long Dim i As Long Dim j As Long Dim k As Long Dim oVar As Variant pIndex = 0 i = 0 j = 0 k = 0 If ActiveDocument.ProtectionType <> wdNoProtection Then ActiveDocument.Unprotect End If Set oFrmFlds = ActiveDocument.FormFields For pIndex = 1 To oFrmFlds.Count oFrmFlds(pIndex).Select Select Case oFrmFlds(pIndex).Type Case wdFieldFormTextInput oVar = oFrmFlds(pIndex).Result i = i + 1 With Dialogs(wdDialogFormFieldOptions) .Name = "Text" & i .Execute End With oFrmFlds(pIndex).Result = oVar Case wdFieldFormCheckBox oVar = oFrmFlds(pIndex).CheckBox.Value j = j + 1 With Dialogs(wdDialogFormFieldOptions) .Name = "Check" & j .Execute End With oFrmFlds(pIndex).CheckBox.Value = oVar Case wdFieldFormDropDown oVar = oFrmFlds(pIndex).DropDown.Value k = k + 1 With Dialogs(wdDialogFormFieldOptions) .Name = "DropDown" & k .Execute End With On Error Resume Next oFrmFlds(pIndex).DropDown.Value = oVar On Error GoTo 0 Case Else 'Do Nothing End Select Next pIndex ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True lbl_Exit: Exit Sub End Sub |
Tags |
"string too long", word formfield |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Renaming Book Marks in Microsoft Word (2007) | cheondee | Word | 0 | 03-04-2011 10:36 PM |
Rules for when a long word should be split | pjl9 | Word | 1 | 09-28-2010 07:07 AM |
inserting a string of data into an MS Word table??? | matto | Word VBA | 0 | 07-16-2010 09:35 AM |
Word :mac 2008 is crashing all day long... | P. Alkuin | Word | 4 | 04-20-2010 10:47 PM |
How much long auhtentic is a word document? | plaszma | Word | 0 | 11-08-2009 09:28 AM |