Results 1 to 8 of 8
  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
    Oct 2003
    Location
    US
    Posts
    343
    Check if you have the default printer check mark set against the default printer. Access needs a default printer installed for any report to run.

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    It has default printer. Could you please figure out this for me. I need to fix it as soon as possible. Thanks again!

  4. #4
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    Read this article. Maybe that'll help.

    http://word.mvps.org/FAQs/MailMerge/...PrintrWVBA.htm

  5. #5
    Join Date
    Mar 2004
    Posts
    660
    I check the verson of both microsoft word are same. I still don't know what is the problem. Thanks again.

  6. #6
    Join Date
    Jul 2004
    Posts
    5
    Just curious, can you open the mail merge document in word and send it to the printer from the pc that has the error?

  7. #7
    Join Date
    Mar 2004
    Posts
    660
    Yes, I can send the mail merge document (that didn't have data on the word) to the printer. That is no problem. Still don't know why.

  8. #8
    Join Date
    Mar 2004
    Posts
    660
    Also i try to print a word file for that printe. It works with no problem. But when i run the program, it didn't work.

Posting Permissions

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