none
VB6 and MS Word 2010 RRS feed

  • Question

  • I have an application that was created in VB6 and is used to populate MS Word documents using bookmarks embedded in the documents. 

    One of my client purchased a new computer with Office 2010 and is getting the following:

    "Active X component Can't create object: 429"

    Current Reference

    MS Word 8.0 Object Library

    Sample Code

    Public Sub PrintDoc()

        WrdCall (1)

        Dim objDoc As Word.Document

        Set objDoc = WrdApp.Documents.Open(c:\bankletter.dot")
        objDoc.Bookmarks("BankName").Range.Text = bankname
        objDoc.Bookmarks("BankStreet").Range.Text = BankStreet
        objDoc.Bookmarks("BankCityStateZip").Range.Text = BankCityStateZip
        objDoc.SaveAs a4

    End Sub

    Current call Word Module

    Option Explicit
    Public WrdApp As Word.Application
    Dim Y As Variant

     

    Public Sub WrdCall(X As String)
        Y = 0
        On Error GoTo Apperror
        If X = 1 Then
             Set WrdApp = GetObject(, "Word.Application")
             If Y = 0 Then Exit Sub
             Set WrdApp = CreateObject("Word.Application")
             WrdApp.Visible = False
        End If
        If X = 0 Then
            If WordInt = True Then
            Else
                WrdApp.Quit
                Set WrdApp = Nothing
            End If
        End If

    Exit Sub
    Apperror:
    Y = Err.Number
    Select Case Err.Number
    Case 91 'Tried to close word before it opens
    Exit Sub
    Case 462 'Ms Word Did not Open
    If X = 1 Then Resume
    Exit Sub
    Case 429 'Ms Word Did not Open
    Resume Next
    Case Else
    Exit Sub
    End Select
    End Sub

     

    Public Sub WrdCallInt(X As String)
        On Error GoTo err_WrdCallInt
        If X = 1 Then
            Set WrdApp = GetObject(, "Word.Application")
            WordInt = True
        End If
    Exit Sub
    err_WrdCallInt:
    End Sub

    Thank you in advance for your help!
    Friday, December 10, 2010 12:41 PM

Answers

  • Hi Lee

    <<One of my client purchased a new computer with Office 2010 and is getting the following:

    "Active X component Can't create object: 429" >>

    Which line of code is causing the error?

    If this is only the one client, here are the trouble-shooting questions that occur to me, please work through them in the given order.

    1. Are you sure he's got the full version of Office 2010 and not the "Click-and-run" version? Your code won't work if he's got Click-and-run, as that works in a virtual machine environment that code running under Windows won't have access to. If he wants to use your app, he'll need to go back to the site where he downloaded Office and choose the option to intalls the full version.

    2. If you create, say, an Excel workbook that uses the same line of code causing the error, does that run? (Don't do this before getting an answer to Click-and-run!)

    3. If the user creates a new profile under Windows, does the problem code work?

    4. The user has Windows 7: 32-bit or 64-bit? And how is Office installed: as 32-bit or 64-bit?


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Wednesday, December 22, 2010 10:51 AM
    • Marked as answer by Bessie Zhao Monday, December 27, 2010 7:10 AM
    Tuesday, December 14, 2010 11:32 AM
    Moderator

All replies

  • FWIW after fixing a few thing things that would cause errors in the code as it stands (declare WordInt, set BankName etc. and a4 to test values) this ran OK on my system.

    I wondered if it might be to do with bankletter.dot being in the root folder of c:\ - that's more likely to cause problems on recent versions of Windows (certainly, trying to save anything to the root of c:\ will.

    Otherwise, having an out of date Word Object Library reference does not appear to cause any problems in this particular case (I would not have expected it to).


    Peter Jamieson
    Saturday, December 11, 2010 9:00 AM
  • Thanks Peter,

    Actually originally it was not saving it to the c:.

    Are you using Office 2010?

    If so, are there any settings in Word that you are setting?

    Thanks again Peter!

    Monday, December 13, 2010 8:39 PM
  • > Are you using Office 2010?

    That's what I used for this test (Win7+Office 2010 Pro).

    The only potentially significant difference that I can see is that I compiled the application on VB6 on WinXP on a system that has the MS Word 11.0 (Word 2003) object library, not the MS Word 8.0 object library (Word 97, I think). I have assumed that the main point from a test point of view is that it doesn't have to be the Word 2010 object library, but perhaps there is some other difficulty I'm not aware of.

    > if so, are there any settings in Word that you are setting?

    Nothing that seems relevant to me. Perhaps worth checking whether Word 2010 cares in this case whether your document is in a trusted location or not.

    What happens if Word is already running? In that case, I'd hope the "GetObject" code would succeed.

    Peter Jamieson
    Monday, December 13, 2010 9:01 PM
  • I'm compiling on WinXP w/ Office 97 (you are right it is the MS Word 8.0 Object Library) because some of the workstations have Word 2000.  It hasn't been a problem up until now and a lot of the systems are Win7 w/ Office 2007. 

    On the problem systems running Win7 and Office 2010 I had set the security level to Full Control on the local folder used for their documents(templates).

    So I guess it's time to move on or....

    ....is it possible to reference both object libraries and determine what version of Word they are running before a making a call. 

    Bottom line is I need to compile using the 2003 object library, determine if that is the issue, and if it is just go through the motions. 

    Thanks again for your help Peter.

     

    Monday, December 13, 2010 11:08 PM
  • FWIW I do not think the version of the Object library /is/ the issue - it's simply the most obvious difference that I haven't been able to check out here.


    Peter Jamieson
    Monday, December 13, 2010 11:12 PM
  • Hi Lee

    <<One of my client purchased a new computer with Office 2010 and is getting the following:

    "Active X component Can't create object: 429" >>

    Which line of code is causing the error?

    If this is only the one client, here are the trouble-shooting questions that occur to me, please work through them in the given order.

    1. Are you sure he's got the full version of Office 2010 and not the "Click-and-run" version? Your code won't work if he's got Click-and-run, as that works in a virtual machine environment that code running under Windows won't have access to. If he wants to use your app, he'll need to go back to the site where he downloaded Office and choose the option to intalls the full version.

    2. If you create, say, an Excel workbook that uses the same line of code causing the error, does that run? (Don't do this before getting an answer to Click-and-run!)

    3. If the user creates a new profile under Windows, does the problem code work?

    4. The user has Windows 7: 32-bit or 64-bit? And how is Office installed: as 32-bit or 64-bit?


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Wednesday, December 22, 2010 10:51 AM
    • Marked as answer by Bessie Zhao Monday, December 27, 2010 7:10 AM
    Tuesday, December 14, 2010 11:32 AM
    Moderator