Word Merge Failing on Windows XP (1 Viewer)

sparklegrrl

Registered User.
Local time
Today, 20:30
Joined
Jul 10, 2003
Messages
124
PLEASE HELP!!! Boss getting on my case HARD!

I am having a MAJOR problem with the new database I wrote. I have several forms in the database that merge with word and spit out customer special reports, etc.

On my machine it works GREAT! I am running Windows 2000 and the code I am using is:

=============================================
Code:
Private Sub MergeButton_Click()
    On Error GoTo MergeButton_Err

    Dim objWord As Word.Application

    'Start Microsoft Word 97.
    Set objWord = CreateObject("Word.Application")

    With objWord
        'Make the application visible.
        .Visible = True

        'Open the document.
        .Documents.Open ("F:\DatabaseFiles\GATXINSPECTIONFORMS.doc")

        'Move to each bookmark and insert text from the form.
        .ActiveDocument.Bookmarks("PurchaseOrder").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!PurchaseOrderID))
        .ActiveDocument.Bookmarks("CarInitials").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
        .ActiveDocument.Bookmarks("CarNumber").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
        .ActiveDocument.Bookmarks("CarInitial2").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
        .ActiveDocument.Bookmarks("CarNumber2").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
        .ActiveDocument.Bookmarks("PurchaseOrder2").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!PurchaseOrderID))
        .ActiveDocument.Bookmarks("Thickness").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Thickness.Column(1)))
        .ActiveDocument.Bookmarks("Rubber").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!Inventory))
        .ActiveDocument.Bookmarks("Vendor").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!Vendor))
        .ActiveDocument.Bookmarks("Pipe").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Pipe.Column(1)))
        .ActiveDocument.Bookmarks("LiningDate").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXliningdate))
        .ActiveDocument.Bookmarks("Employee1").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXInspector.Column(3)))
        .ActiveDocument.Bookmarks("Title").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Title))
        .ActiveDocument.Bookmarks("CarInitial3").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
        .ActiveDocument.Bookmarks("CarNumber3").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
        .ActiveDocument.Bookmarks("CarInitial4").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
        .ActiveDocument.Bookmarks("CarNumber4").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
        .ActiveDocument.Bookmarks("Employee2").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXInspector.Column(3)))
        .ActiveDocument.Bookmarks("CarInitial5").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
        .ActiveDocument.Bookmarks("CarNumber5").Select
        .Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
        End With

    'Print the document in the foreground so Microsoft Word will not close
    'until the document finishes printing.
    objWord.ActiveDocument.PrintOut Background:=False

    'Close the document without saving changes.
    objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

    'Quit Microsoft Word and release the object variable.
    objWord.Quit
    Set objWord = Nothing
    Exit Sub

MergeButton_Err:
    'If a field on the form is empty, remove the bookmark text, and
    'continue.
    If Err.Number = 94 Then
        objWord.Selection.Text = ""
        Resume Next

   

    Exit Sub
End If
End Sub
============================================

This works A-OK on my machine however on all of the other machines in the office, it only opens word and then just stops. Nothing happens. There is 1 other machine running Word 2000 and the other 3 are XP machines but it doesn't work on any of them.

I checked the references in VB and all of the computers have the following items checked:

* Visual Basic for Applications
* Microsoft Access 11.0 Object Library
* OLE Automation
* Microsoft ActiveX Data Objects Library 2.1
* Microsoft Word 10.0 Library
* Microsoft Office 11.0 Object Library

I am at a total loss and my boss is really coming down on my case. Can anyone help?

* Edit by Mile-O-Phile. Reason: Long code without BB Code Tags.
 
Last edited by a moderator:

___

¯¯¯¯¯
Local time
Today, 20:30
Joined
Nov 27, 2003
Messages
595
Just a shot in the dark, are the references all checked in the same order on the other pc's as they are on yours?
 

sparklegrrl

Registered User.
Local time
Today, 20:30
Joined
Jul 10, 2003
Messages
124
I checked one of the XP machines and the other 2000 machine and yes they are in the same order.

I got an error on the XP machine though that said:

"........missing or broken reference to the file MSWORD.OLB Version 8.2"

Could that be the problem? What is it and how do I fix it?
 

asmodius

Registered User.
Local time
Today, 20:30
Joined
Oct 22, 2003
Messages
60
An outside of Access perspective..

I see that the word doc being opened is on a mapped network drive. F. Did you make sure that all other users have the same permissions as you to that drive and that file? I am not that great with access, but your code looks very uniform. I would think that since it works on your machine theres nothing wrong with the code. At this point I would try that if you haven't.

Hope it helps!

Andy

P.S. It may also be local permissions. MSWORD.OLB looks like a system file of some sort. You may want to check here.

http://216.239.57.104/search?q=cach...um.com/t117796.html+msword.olb&hl=en&ie=UTF-8[/url]

It looks related.

In fact thats probably it. Since you had to use access your machine has visual basic for applications installed. But theirs probably don't. Try re-installing office. This time as COMPLETE. Not typical.
 
Last edited:

sparklegrrl

Registered User.
Local time
Today, 20:30
Joined
Jul 10, 2003
Messages
124
THANK YOU VERY MUCH! I will give that a try this morning!
 

sparklegrrl

Registered User.
Local time
Today, 20:30
Joined
Jul 10, 2003
Messages
124
That link didn't work. Can you repost it?

THANKS SO MUCH!
 

asmodius

Registered User.
Local time
Today, 20:30
Joined
Oct 22, 2003
Messages
60
sorry..

The link was a chached google search for the words msword.olb that lead me to this site..

http://www.visualbasicforum.com/t117796.html

Really I just wanted to show you that msword.olb is a required file to run visual basic for applications tie in to word. If you install the visual basic for applications on the machines it doesn't work on all should work just like on your machine. I believe that with a complete install of office you get visual basic for applications.

Here is a microsoft article that is somewhat related. It also shows you how to install VB for apps.

http://support.microsoft.com/default.aspx?scid=kb;en-us;281952

good luck!!!

Andy
 

asmodius

Registered User.
Local time
Today, 20:30
Joined
Oct 22, 2003
Messages
60
by the way....

By the way, are you absolutely sure its o.k. to use the ' charachter to point out lines that are just for explanation and not your code. Usually I see people use #. I'm not a very good programmer and just want to know.

Thanks,

Andy
 

asmodius

Registered User.
Local time
Today, 20:30
Joined
Oct 22, 2003
Messages
60
O.k. Here it goes again...

Your issue: Access database runs on your machine, calls up word and prints out neat report. On other machines same database runs, but does not call up word and does not print reports right.

Possible Causes:

1. Network permissions to the file shares
2. Local permissions, ie not member of power users, or admin groups. (probably not going to be this but worth a shot)
3. Visual Basic for MS Office is not installed. (most likely it) Here is why: Visual basic must be installed on a system for it to run. The typical MS Office installation does not install visual basic. So when the database asks it to run VB code it may not be able to run it,all or at all. So instaling VB might seem the best plan. To install it follow the instructions on this MS page.

http://support.microsoft.com/defaul...kb;en-us;281952

Now completely outside of your issue. The following question has nothing to do with your problem I think. Normally when people put lines in Visual Basic that are not code ie.

'If a field on the form is empty, remove the bookmark text, and
'continue.

They use the # character i.e.

#If a field on the form is empty, remove the bookmark text, and
#continue
 

Users who are viewing this thread

Top Bottom