I have a form with many many fields in it. These fields need to be renamed and other options set.
The problem: I can’t set the name if I use a string variable. If I simple write the name in quotes it works – but at that rate I might as well open up each field in word.
Sub ReSetFieldsNew() Const Split = "_" Dim strGroupName As String Dim IntChoices As Integer Dim intCounter As Integer Dim strFieldName As String Dim rngDoc As Range strGroupName = InputBox("Enter QuestionName") IntChoices = Selection.FormFields.Count Set rngDoc = Selection.Range For intCounter = 1 To IntChoices strFieldName = strGroupName & Split & IntChoices & Split & intCounter Debug.Print strFieldName With Selection.FormFields(intCounter) .Name = strFieldName ' this doesn't work - however if I use "Fred_3_1" everything is good .EntryMacro = "RadioCheckBox" .ExitMacro = "RadioCheckBox" .CalculateOnExit = True Debug.Print .Name End With rngDoc.Select Next intCounter End Sub
I’d sure appreciate another pair of eyes, to see what I’m missing.