Without the rest of the code, anyone trying to assist is flying blind. I think I understand the concept of what the macro is doing and the following will do that provided the values in the variables are appropriate:
Code:
Option Explicit
Sub Macro1()
Dim prevSent As Range
Dim sentNumb As Long
If do_DocVars_Exist = True Then
sentNumb = ActiveDocument.Variables("selNumb").Value
If ActiveDocument.Sentences.Count >= sentNumb Then
Set prevSent = ActiveDocument.Sentences(sentNumb)
With prevSent
.Select
.Font.Size = ActiveDocument.Variables("selSize").Value
.Font.Color = ActiveDocument.Variables("selColor").Value
.Font.Name = ActiveDocument.Variables("selName").Value
End With
Else
MsgBox "There is no sentence number " & sentNumb
End If
Else
MsgBox "The required variables are not present"
End If
End Sub
Function do_DocVars_Exist() As Boolean
Dim oVar As Variable
Dim iVar As Integer: iVar = 0
For Each oVar In ActiveDocument.Variables
Select Case oVar.Name
Case "selNumb", "selSize", "selColor"
If IsNumeric(oVar.Value) Then
iVar = iVar + 1
End If
Case "selName"
iVar = iVar + 1
End Select
Next oVar
If iVar = 4 Then do_DocVars_Exist = True
End Function