From: Bob Vance on

"David W. Fenton" <XXXusenet(a)dfenton.com.invalid> wrote in message
news:Xns9D6AAA89E9E98f99a49ed1d0c49c5bbb2(a)74.209.136.91...
> "Bob Vance" <rjvance(a)ihug.co.nz> wrote in
> news:uXgR3qD6KHA.3656(a)TK2MSFTNGP06.phx.gbl:
>
>> I did what you said and got this error
>> Error Number 463
>> Description: Class not registered on local machine
>> Regards Bob
>
> Which line of code as highlighted as producing that error?
>
> --
> David W. Fenton http://www.dfenton.com/
> usenet at dfenton dot com http://www.dfenton.com/DFA/
Thanks David, I am getting no error on Debug only when I go to use this code
do I get that error (463) message pop up
------------------------------------------
Private Sub SendMailButton_Click()

On Error GoTo ErrorHandler
If Me.Dirty = True Then
Me.Dirty = False
Dim myfile1 As String, myfile2 As String
End If
Dim mydir As String
mydir = Left(CurrentDb.Name, Len(CurrentDb.Name) -
Len(Dir(CurrentDb.Name)))
Dim lngID As Long, strMail As String, strBodyMsg As String, _
blEditMail As Boolean, sndReport As String, strCompany As String
Dim msgPmt As String, msgBtns As Integer, msgTitle As String, msgResp As
Integer, tbAmount As String
Dim strFormat As String
Dim mytot As Long
mytot = DCount("[InvoiceID]", "qrySelInvoices", "")

Select Case Me.tbEmailOption.value

Case "ADOBE"
strFormat = acFormatPDF
myfile1 = mydir & "Statement.pdf"
myfile2 = mydir & "Invoice.pdf"
Case "WORD"
strFormat = acFormatRTF
myfile1 = mydir & "Statement.rtf"
myfile2 = mydir & "Invoice.rtf"

Case "SNAPSHOT"
strFormat = acFormatSNP
myfile1 = mydir & "Statement.SNP"
myfile2 = mydir & "Invoice.SNP"

Case "TEXT"
strFormat = acFormatTXT
myfile1 = mydir & "Statement.txt"
myfile2 = mydir & "Invoice.txt"

Case "HTML"
strFormat = acFormatHTML
myfile1 = mydir & "Statement.htm"
myfile2 = mydir & "Invoice.htm"

Case Else ' catch all others
strFormat = acFormatHTML
myfile1 = mydir & "Statement.htm"
myfile2 = mydir & "Invoice.htm"

End Select

Select Case Me.OpenArgs

Case "OwnerStatement"

sndReport = "rptOwnerPaymentMethod"


lngID = Nz(Me.cbOwnerName.Column(0), 0)
strMail = OwnerEmailAddress(lngID)
tbAmount = Nz(Me.cbOwnerName.Column(5), 0)

strBodyMsg = "To: "
strBodyMsg = strBodyMsg & Nz(DLookup("[ClientTitle]",
"tblOwnerInfo", _
"[OwnerID]=" & lngID), " ") & " "
strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerLastName]",
"tblOwnerInfo", _
"[OwnerID]=" & lngID), " Owner")
strBodyMsg = strBodyMsg & "," & Chr(10) & Chr(10) & Chr(13) _
& "Please find attached your Statement, Dated:" & " " &
Format(Date, "d-mmm-yyyy") & Chr(10) & "Your Statement Total: " &
Format(tbAmount, "$ #,##.00") & Chr(10) & Chr(10) &
Nz(DLookup("[EmailMessage]", "tblCompanyInfo"), "") & eMailSignature("Best
Regards", True) & Chr(10) & Chr(10) & DownloadMessage("PDF") _


DoCmd.OutputTo acOutputReport, sndReport, strFormat,
myfile1, False
If mytot > 0 Then
DoCmd.OutputTo acOutputReport, "rptInvoiceModify",
strFormat, myfile2, False
End If

CurrentDb.Execute "UPDATE tblOwnerInfo " & _
"SET EmailDateState = Now() " & _
"WHERE OwnerID = " & lngID, dbFailOnError
Dim myitem As Object
Dim myout As Object
Set myout = CreateObject(Outlook.Application, "localhost")
Set myitem = myout.CreateItem(olMailItem)

With myitem
.To = strMail
.CC = Nz(DLookup("EmailCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Bcc = Nz(DLookup("EmailBCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Subject = "Your Statement" & " / " & Nz(DLookup("[CompanyName]",
"tblCompanyInfo"))
.Body = strBodyMsg 'EditMessage:=blEditMail
.Attachments.Add myfile1
If mytot > 0 Then
.Attachments.Add myfile2
End If
On Error Resume Next
.Send
On Error GoTo ErrorHandler
End With
Set myitem = Nothing
Set myout = Nothing
cbOwnerName.SetFocus

Case Else
Exit Sub

End Select
ExitProc:
Exit Sub
ErrorHandler:

msgTitle = "Untrapped Error"
msgBtns = vbExclamation

Select Case Err.Number
'User cancelled message (2293 & 2296 are raised
'by Outlook, not Outlook Express).
Case 2501, 2293, 2296
Case Else
MsgBox "Error Number: " & Err.Number & Chr(13) _
& "Description: " & Err.Description & Chr(13) & Chr(13) _
& "(frmBillStatement SendMailButton_Click)", msgBtns, msgTitle
End Select

Resume ExitProc

End Sub


From: David W. Fenton on
"Bob Vance" <rjvance(a)ihug.co.nz> wrote in
news:OzcfTjK6KHA.6052(a)TK2MSFTNGP02.phx.gbl:

> "David W. Fenton" <XXXusenet(a)dfenton.com.invalid> wrote in message
> news:Xns9D6AAA89E9E98f99a49ed1d0c49c5bbb2(a)74.209.136.91...
>> "Bob Vance" <rjvance(a)ihug.co.nz> wrote in
>> news:uXgR3qD6KHA.3656(a)TK2MSFTNGP06.phx.gbl:
>>
>>> I did what you said and got this error
>>> Error Number 463
>>> Description: Class not registered on local machine
>>> Regards Bob
>>
>> Which line of code as highlighted as producing that error?
>
> Thanks David, I am getting no error on D

Turn off your error handler and re-run the code. That will highlight
the offending line of code.

Without that, there is no way for anyone to help you at all --
nobody is going to go through and guess which line of code is
producing the error.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
From: Bob Vance on

> Turn off your error handler and re-run the code. That will highlight
> the offending line of code.
>
> Without that, there is no way for anyone to help you at all --
> nobody is going to go through and guess which line of code is
> producing the error.
>
> --
> David W. Fenton http://www.dfenton.com/
> usenet at dfenton dot com http://www.dfenton.com/DFA/

Thanks David
The Highlighted row was:
Set myout = CreateObject(Outlook.Application, "localhost")
Regards Bob



CurrentDb.Execute "UPDATE tblOwnerInfo " & _
"SET EmailDateState = Now() " & _
"WHERE OwnerID = " & lngID, dbFailOnError
Dim myitem As Object
Dim myout As Object
Set myout = CreateObject(Outlook.Application, "localhost")
'Set myitem = myout.CreateItem(olMailItem)
Set myitem = myout.CreateItem(0)


From: Douglas J. Steele on
I believe you need

Set myout = CreateObject("Outlook.Application", "localhost")

although the following may suffice:

Set myout = CreateObject("Outlook.Application")

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/djsteele
(no e-mails, please!)



"Bob Vance" <rjvance(a)ihug.co.nz> wrote in message
news:egmngtZ6KHA.3184(a)TK2MSFTNGP05.phx.gbl...
>
>> Turn off your error handler and re-run the code. That will highlight
>> the offending line of code.
>>
>> Without that, there is no way for anyone to help you at all --
>> nobody is going to go through and guess which line of code is
>> producing the error.
>>
>> --
>> David W. Fenton http://www.dfenton.com/
>> usenet at dfenton dot com http://www.dfenton.com/DFA/
>
> Thanks David
> The Highlighted row was:
> Set myout = CreateObject(Outlook.Application, "localhost")
> Regards Bob
>
>
>
> CurrentDb.Execute "UPDATE tblOwnerInfo " & _
> "SET EmailDateState = Now() " & _
> "WHERE OwnerID = " & lngID, dbFailOnError
> Dim myitem As Object
> Dim myout As Object
> Set myout = CreateObject(Outlook.Application, "localhost")
> 'Set myitem = myout.CreateItem(olMailItem)
> Set myitem = myout.CreateItem(0)
>

From: David W. Fenton on
"Bob Vance" <rjvance(a)ihug.co.nz> wrote in
news:egmngtZ6KHA.3184(a)TK2MSFTNGP05.phx.gbl:

> The Highlighted row was:
> Set myout = CreateObject(Outlook.Application, "localhost")

As you reported earlier, the error was:

>> Error Number 463
>> Description: Class not registered on local machine

Doug suggested you try removing the "localhost" (it shouldn't make a
difference, as that's the default, but if you leave it out, it can
be blocked by some security software).

The message is not believable, given that you had previously used
early binding, with a reference to Outlook, right?

Try repairing your Office installation and trying again.

Also, did you fix the olMailItem problem? The line of code
immediately after the offending line in the code you posted has a
reference to that constant, which will be undefined without the
reference (unless you redefined it yourself). I know it's not the
highlighted line, but it's worth a try. Of course, it should give
you a compile error instead of a runtime error. You *do* compile
your code, right?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: Icons in tab pages
Next: Save Button