Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Oct 2011
    Location
    Auckland. New Zealand
    Posts
    55
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Changing ADO connections in VB because of Word upgrade?

    I developed a Word template for someone almost 2 years ago (and therefore I can't remember much about how I did it now). Amongst other things the template accesses an Excel spreadsheet using an ADO connection.

    The statement I use to set this up is:

    With cnt
    .Provider = "Microsoft.ACE.OLEDB.12.0"
    .ConnectionString = sConn
    .Open
    End With

    The template was used extensively with no problems until the person I developed it for decided to upgrade to Word 2013. During their testing to make sure everything was going to run okay, they encountered a Run-time error 80040e37. (see attached screen shot) As far as I know they were able to open a document based on the template, but they encountered this error when they tried to do particular functionality. I haven't been able to confirm this yet.

    As my user and I are no longer in the same location, I copied his version of the template (to make sure we were using the same one), onto my laptop. Now when I try to create a document based on that template (by going to Word, clicking on New, and selecting the template) I am getting a Run-time error 80004005 (see attached screen shot). I have worked out that my run-time error is caused by the 'With cnt..." statement above.

    Unfortunately, after 2 years, I can't remember how I worked out that the provider should be "Microsoft.ACE.OLEDB.12.0". I have gone into Tools, References and have scrolled down the list but could not find this reference. I did find a "Microsoft Access 14.0 Object Library" so I tried checking this and changing the version in the statement from 12.0 to 14.0, but no joy. (I got another error message and as I was clutching at straws I won't confuse the issue by noting it.)

    I did find some instructions in a textbook that said to look for a reference starting with "Microsoft ActiveX Data Objects", and I did find a newer version of this (6.1 instead of 2.8) but checking on it doesn't seem to have made a difference (i.e I still get the same run-time errror).

    As usual, I have got myself all confused.

    I don't know if the two run-time errors are linked (e.g. my error is appearing because I'm running Windows 7 and not XP any more), and my user's error is caused because they've upgraded to Office 2013 (and possibly Windows 8? - I can check if I'm on the right track) or if it is a coincidence and they are totally unrelated.

    Any help would be appreciated. At this stage, obviously I am trying to sort out my run-time error so I can see if I can run the template okay on my laptop. Once I've confirmed this, I'll go visit my user and confirm what he's doing.
    Run-time error 80040e37.pngRun-time error 80004005.png

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Star Lounger
    Join Date
    Oct 2011
    Location
    Auckland. New Zealand
    Posts
    55
    Thanks
    8
    Thanked 0 Times in 0 Posts
    SOLVED

    That's what I love about VBA (NOT) - the problem was totally unrelated to the upgrade in Word. (We only had to apply a small fix to change the location of the templates so they could be accessed from a network.) Nope, the problem was that neither of us had the required file in the required directory (I'd rebuilt my computer a few weeks ago so it had disappeared). So, the good news is that it's solved. I know, I know, I should have spotted that first, at least for my computer, but there you go.

  4. #3
    Administrator
    Join Date
    Jun 2010
    Location
    Portugal
    Posts
    10,050
    Thanks
    129
    Thanked 1,114 Times in 1,026 Posts
    Glad you solved it and thanks for posting the solution.
    Rui
    -------
    R4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •