D
David W. Fenton
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?
I did what you said and got this error
Error Number 463
Description: Class not registered on local machine
Regards Bob
Thanks David, I am getting no error on Debug only when I go to use this codeDavid W. Fenton said: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.
The Highlighted row was:
Set myout = CreateObject(Outlook.Application, "localhost")
I believe you need
Set myout = CreateObject("Outlook.Application", "localhost")
although the following may suffice:
Set myout = CreateObject("Outlook.Application")
David W. Fenton said:As you reported earlier, the error was:
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?
Note that he's missing the quotes around "Outlook.Application"
I am not getting any error messages and my 2 reports are going
to my Local Directory but not going to Outlook!
Bob Vance said:David W. Fenton said:As you reported earlier, the error was:
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?
Thanks David, I am not getting any error messages and my 2 reports are
going to my Local Directory but not going to Outlook!
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 myout = CreateObject("Outlook.Application")
'Set myitem = myout.CreateItem(olMailItem)
Set myitem = myout.CreateItem(0)
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
Douglas J. Steele said:You've commented out the .Send command.
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
Bob Vance said:David W. Fenton said: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?
Thanks David, I am not getting any error messages and my 2 reports are
going to my Local Directory but not going to Outlook!
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 myout = CreateObject("Outlook.Application")
'Set myitem = myout.CreateItem(olMailItem)
Set myitem = myout.CreateItem(0)
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
Bob Vance said:Thanks Douglas, Thats a good reason why it would not send
Thank you very much for your help much appreciated, all good now
Regards Bob
news:[email protected]...
So now I must re code my funGetHorse as its ADODB?