The only thing that striked me as odd is your getObject. I usually use CreateObject like this:
I know you can get there through GetObject too but I seem to recall that the syntax would be different than what you are using.
Other than that: the issue my abe one line above where you are looking. If the FMDocs is null then the lines below it will fail. Add some error trapping on the FMDocs line.