I'm not re-opening the db.
I found the problem.
the macro was calling the function this way:
=Main()
When it should have been calling it this way:
Main()

Thanks,