• Word mail merge failure (Word 2000 / Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Word mail merge failure (Word 2000 / Access 2000)

    Author
    Topic
    #408061

    I have a Word mail merge that I invoke from Access VBA. I run it at least once per day.

    Recently it started failing on this statement: Set loWd = New Word.Application
    with this error message:

    Run-time error ‘-2147221231 (80040111)’:
    Automation error
    ClassFactory cannot supply requested class

    The cure for me is to uninstall Word, then to re-install Word. Then the VBA mail merge works fine.

    I am curious about the cause of the error. I have LOTS of software installed, and so far I have not been able to identify a cause and effect relationship for the failures. I wold love to fix it so it doesn’t keep breaking on me.

    If anyone has experienced this, or can enlighten me, I would be most grateful!

    Viewing 5 reply threads
    Author
    Replies
    • #858370

      Do you have more than one version of Microsoft Office installed? That seems to be a possible scenario for this error. If you get this error again, check Tools | References… in the Visual Basic Editor to see if you have a reference to the correct Word object library (9.0 for Word 2000)

      • #858390

        Hans, I have been using Office 2000 exclusively, so I don’t have any other versions installed.

        The first thing I did when I got the error was to check the references in my VBA project. I had the correct Word 9.0 library reference, but it wouldn’t let me create a new instance of Word.

        • #858392

          I’m afraid I don’t know what causes your problems then, apart from a corrupt installation, which uninstalling/reinstalling would fix, as in your situation. But “corrupt installation” is not a very satisfactory explanation…

        • #858393

          I’m afraid I don’t know what causes your problems then, apart from a corrupt installation, which uninstalling/reinstalling would fix, as in your situation. But “corrupt installation” is not a very satisfactory explanation…

      • #858391

        Hans, I have been using Office 2000 exclusively, so I don’t have any other versions installed.

        The first thing I did when I got the error was to check the references in my VBA project. I had the correct Word 9.0 library reference, but it wouldn’t let me create a new instance of Word.

    • #858371

      Do you have more than one version of Microsoft Office installed? That seems to be a possible scenario for this error. If you get this error again, check Tools | References… in the Visual Basic Editor to see if you have a reference to the correct Word object library (9.0 for Word 2000)

    • #858580

      tough problem. it looks like something is corrupting the registry.
      you might want to try the following (make sure no instances of word are running – if you’re not sure, reboot the computer)
      now click start->run and enter “winword /r” (according to mskb the switch for word2000 is /r (and not /regserver)) without the quotes and press enter. this will reregister word’s automation classes.
      also, iirc, the ‘set x=new “classname”‘ construct bypasses some stages in the creation of a class instance, so your problem could possibly be solved by using a
      dim loWd as word.application
      Set loWd = createobject(“word.application”)
      note:you can still use early binding for this statement and all your other statements if you leave the reference to the word object library.

    • #858581

      tough problem. it looks like something is corrupting the registry.
      you might want to try the following (make sure no instances of word are running – if you’re not sure, reboot the computer)
      now click start->run and enter “winword /r” (according to mskb the switch for word2000 is /r (and not /regserver)) without the quotes and press enter. this will reregister word’s automation classes.
      also, iirc, the ‘set x=new “classname”‘ construct bypasses some stages in the creation of a class instance, so your problem could possibly be solved by using a
      dim loWd as word.application
      Set loWd = createobject(“word.application”)
      note:you can still use early binding for this statement and all your other statements if you leave the reference to the word object library.

    • #859175

      I may be way off base here, but when I was working on this a while back, I had the worst time making my merged Word document open from Access. The code I wrote would go awry one way or another every second or third time. The first time it would open like a charm.

      I sat around and thought about it for a while and then decided on a simple command button linked to the already created merged Word document with a simple macro in the background that stated:

      Open App
      Maximize

      And in the properties section of the macro window what app I wanted open, eg. C:program filesmystuffmerge.doc (Note I did put the merge.doc within the same folder as my database)

      Also a simple hyperlink to the merge doc on the form works fine…you can make it look like a command button with just a bit of formatting.
      Either way the link has already been established between the database and the word document through the use of the Office Links Icon on the standard toolbar and it:

      Worked everytime. Seemed simpler. Not sure if this is any help or not

    • #859176

      I may be way off base here, but when I was working on this a while back, I had the worst time making my merged Word document open from Access. The code I wrote would go awry one way or another every second or third time. The first time it would open like a charm.

      I sat around and thought about it for a while and then decided on a simple command button linked to the already created merged Word document with a simple macro in the background that stated:

      Open App
      Maximize

      And in the properties section of the macro window what app I wanted open, eg. C:program filesmystuffmerge.doc (Note I did put the merge.doc within the same folder as my database)

      Also a simple hyperlink to the merge doc on the form works fine…you can make it look like a command button with just a bit of formatting.
      Either way the link has already been established between the database and the word document through the use of the Office Links Icon on the standard toolbar and it:

      Worked everytime. Seemed simpler. Not sure if this is any help or not

    Viewing 5 reply threads
    Reply To: Word mail merge failure (Word 2000 / Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: