I have a user Form containing a list box of file names I want inserted into a document. If the user does not select an name from the list, I get a Null error (normal). I want to error trap and remind the user to select the file before pressing OK button. How can I keep the Null error from repeating?
here is my code for the command button on the form:
Private Sub cmdOK_Click()
ChangeFileOpenDirectory ("C:\My Documents"
Dim var As Variant
var = ColorBox.Value
On Error GoTo ErrorHandler
ErrorHandler:
MsgBox "Enter one selection, OK?", vbExclamation
Selection.InsertFile FileName:=var
End Sub
Any ideas? I would think is pretty basic. I think my problem is how to get out of ErrorHandler and back to the macro.
here is my code for the command button on the form:
Private Sub cmdOK_Click()
ChangeFileOpenDirectory ("C:\My Documents"
Dim var As Variant
var = ColorBox.Value
On Error GoTo ErrorHandler
ErrorHandler:
MsgBox "Enter one selection, OK?", vbExclamation
Selection.InsertFile FileName:=var
End Sub
Any ideas? I would think is pretty basic. I think my problem is how to get out of ErrorHandler and back to the macro.