Set wrdApp = CreateObject("Word.Application")



    Hi there


    I'm having difficulty with an old piece of code that has always worked in the past.  I have a macro which copies a series of named ranges out of Excel and pastes them into corresponding bookmarks in a word template.  I have used this succcessfully in ther past but now when I go to use it after a six month break, I get a "Runtime error 13" - type mismatch at the following line of code;


    Set wrdApp = CreateObject("Word.Application")


    I have declared "wrdApp" in the Dim section as follows;


    Dim wrdApp As Word.Application


    All of the resources I have read show this as being correct, and as I say, it has worked fine in the past so I am cmpletely at a loss as to why it wont work now.  I have all of the same references in my project and can't hink of anything else that has changed.  I'd be really gratefuly for any suggestions




    Thursday, October 02, 2008 11:02 AM

All replies

  • I have no idea.

    Just try this please.


    Dim wrdApp As Object
    Set wrdApp = CreateObject("Word.Application")


    Thursday, October 02, 2008 12:34 PM
  • have you moved the word template to a different location?


    Friday, October 03, 2008 4:00 PM
  • Hi there

    Thanks for this, it get' me past the type mismatch error.  The issue I have found subsequently is that there are properties which seem to be specific to the word class which I can use in the object class.  I think I can find a way around this though.  Thanks for your help.

    Tuesday, October 07, 2008 11:11 AM
  • It's still in the same place in the directory tree in relation to the file that calls it, so I don't think it should be a problem, but I'm not 100% sure.
    Tuesday, October 07, 2008 11:28 AM