are you calling this code from within the word document or from an external app?

can you post your code and what the error is?