How do I test for the presence of an option parameter with a function?

Example

Public Sub GridWrite(Grid As Control, FileName As String, Optional AnyForm As Form)

I want to see if the optional parameter "Anyform" was given by the calling form.

I tried:
if AnyForm.Name>"" then
' statements when parameter is given
endif

but I get an error 91: Object variable or With block variable not set.

Same thing with:
if AnyForm >'' then

If the optional parameter is an Integer, then a zero is given but when the parameter is a form, I get the error.

Thanks for your help