Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: Question about "Requested object is not avaliable.

    I have a vb code that when i click the Print button, it will print a
    word file that is mailmerge, it works with no problem in most of computer in
    my office, but one had problem, when I compile, it gave me an error message: Requsted object is not avalilable. The error happen on the code : .Destination= wdSendToPrinter

    (Note: i select regular case).
    >
    The following is the code. I don't know what happen for that computer. It
    works totally fine in other pc. Could someone please figure out this for me.

    The following is the source code for the print button.


    Private Sub cmdPrint_Click()
    Dim wrd As Word.Application
    Dim regletter As Word.Document
    Dim reg2letter As Word.Document
    Select Case Me![CertificationType]

    Case "Apostille"
    DoCmd.OpenReport "Apostille", acViewPreview, , "[GeneralID] =
    Forms![GeneralInfo]![ID]"

    Case "Regular"
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Qry_Regular_Report"
    DoCmd.Close acQuery, "Qry_Regular_Report"

    Set wrd = CreateObject("word.application")
    wrd.Visible = True
    wrd.WindowState = wdWindowStateMaximize
    Set regletter =wrd.Documents.Openfilename:="c:\certification\reg ular.doc")

    With wrd.ActiveDocument.MailMerge
    .Destination = wdSendToPrinter

    .Execute
    End With

    wrd.ActiveDocument.Close (wdDoNotSaveChanges)
    wrd.Quit
    DoCmd.SetWarnings False


    Case "Regular2"
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Qry_Regular2_Report", acViewNormal

    Set wrd = CreateObject("word.application")
    wrd.Visible = True
    wrd.WindowState = wdWindowStateMaximize

    Set reg2letter =
    wrd.Documents.Open(filename:="c:\certification\reg ular2.doc")

    With wrd.ActiveDocument.MailMerge
    .Destination = wdSendToPrinter
    .Execute
    End With

    wrd.ActiveDocument.Close (wdDoNotSaveChanges)
    wrd.Quit
    DoCmd.SetWarnings False

    Case Else
    MsgBox "Select Certification Type for the record", vbOKOnly, "Select Type
    of Certification"
    End Select


    End Sub

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Do you have Word installed on that machine? If yes it could be that you have an older version of word installed then what is refrenced in your code.

    Here is a solution if that is the case:

    1) Open one of your modules or code windows
    2) Select in the menu tools>Refrences
    3) Choose Microsoft Word XX.X Object Library

    (the XX.X is whatever version of word you have installed)
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    I check the tool -> reference. Both are same. They are all:
    Microsoft Word 10.0 Object Library, But it works in my computer, not in anther computer. Can you help me again. Thanks.

  4. #4
    Join Date
    Oct 2003
    Posts
    357
    Hi,
    Make sure that the computer is connected to the printer

    Madhivanan

Posting Permissions

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