Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-15-2013, 07:23 PM
silverspr silverspr is offline Renaming Word Formfields: string too long error Windows 7 64bit Renaming Word Formfields: string too long error Office 2010 64bit
Novice
Renaming Word Formfields: string too long error
 
Join Date: Apr 2011
Posts: 24
silverspr is on a distinguished road
Default Renaming Word Formfields: string too long error

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
Attached Files
File Type: doc WordForumEx.doc (76.0 KB, 13 views)
Reply With Quote
 

Tags
"string too long", word formfield



Similar Threads
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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft