Have you set your references to include Word? If not then the code will not understand what you are doing. Have you used Word in other parts of your code and it work? It might help put the code up so we can see it. You may have a problem elsewhere in your code and it does not become evident until the referenced statement.
Yes I have a reference to word. I found out that this line works under service pack 2 but not under service pack 3 which is what I am currently using. Any reason why it would work under sp2 but not sp3. Do I have to change my references after the update is done.