Not using any error handling is very bad practice. But your error will most probably happen in the sendmailtouser- sub, where you dim a local notesdatabase- object named db without actually initializing it.
The line
set maildoc = New NotesDocument( db )
will fail. Either declare db globally and set it in your initialize or dim ses in that sub again and set db again (worst case as you have to do it for every document)