If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Question about "Requested object is not avaliable.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-09-04, 10:43
yyu yyu is offline
Registered User
 
Join Date: Mar 2004
Posts: 660
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
Reply With Quote
  #2 (permalink)  
Old 07-09-04, 11:58
SCIROCCO SCIROCCO is offline
Registered User
 
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!
Reply With Quote
  #3 (permalink)  
Old 07-09-04, 12:37
yyu yyu is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 07-14-04, 02:44
Madhivanan Madhivanan is offline
Registered User
 
Join Date: Oct 2003
Posts: 357
Hi,
Make sure that the computer is connected to the printer

Madhivanan
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On