A
Ac-Deucy
Below is some VBA code from a Word 2003 macro (not the entire subroutine).
The ActiveDocument.Variable("Document Number") is defined in an earlier
subroutine, and the user is prompted to enter it along with other document
variables. Unfortunately, if the user leaves it blank, the above error
message results. Debug shows that processing stops at the line
If VProcNum = "" Then
Trying some differentl things with this IF statement, VProcNum does not
indicate to be NULL, ISERROR, or ISEMPTY. How do I fix the macro to prevent
this error message? Here's the macro...
Sub ManualTitle()
'
' ManualTitle Macro
'
Dim VProcNum
'
' Create variable for Procedure Number; if it is empty, warn the user
'
Set VProcNum = ActiveDocument.Variables("Document Number")
If VProcNum = "" Then
Style = vbOKOnly + vbInformation + vbDefaultButton1
Response = MsgBox("Without a Document Number, some header variables
will not be populated ", Style, "No Document Number")
End If
The ActiveDocument.Variable("Document Number") is defined in an earlier
subroutine, and the user is prompted to enter it along with other document
variables. Unfortunately, if the user leaves it blank, the above error
message results. Debug shows that processing stops at the line
If VProcNum = "" Then
Trying some differentl things with this IF statement, VProcNum does not
indicate to be NULL, ISERROR, or ISEMPTY. How do I fix the macro to prevent
this error message? Here's the macro...
Sub ManualTitle()
'
' ManualTitle Macro
'
Dim VProcNum
'
' Create variable for Procedure Number; if it is empty, warn the user
'
Set VProcNum = ActiveDocument.Variables("Document Number")
If VProcNum = "" Then
Style = vbOKOnly + vbInformation + vbDefaultButton1
Response = MsgBox("Without a Document Number, some header variables
will not be populated ", Style, "No Document Number")
End If