sparklegrrl
Registered User.
- Local time
- Today, 23:06
- 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:
=============================================
============================================
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.
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: