B
Brad Pears
I have some code that allows me to generate an email from within Access.
When this code is run on my Windows XP machine or our Windows 2003 terminal
server it works fine. However, when it runs on our Windows 2000 terminal
server it crashes every time. The exact same version of access is installed
on each machine (Access 2000) and the same Outlook clients are being used
(Outlook 2002) Also, we are using an Exchange 2000 server.
The references in th eproject to get this code to work is the "Microsoft
Outlook 10.0 Object Library".
The code is as follows and it crashes everytime with an error message of
"-2113732605: The operation failed" on the following line....
Set objEmail = objOutlook.CreateItem(olMailItem)
Here is the whole procedure...
Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
Can anyone help??
Thanks,
Brad
When this code is run on my Windows XP machine or our Windows 2003 terminal
server it works fine. However, when it runs on our Windows 2000 terminal
server it crashes every time. The exact same version of access is installed
on each machine (Access 2000) and the same Outlook clients are being used
(Outlook 2002) Also, we are using an Exchange 2000 server.
The references in th eproject to get this code to work is the "Microsoft
Outlook 10.0 Object Library".
The code is as follows and it crashes everytime with an error message of
"-2113732605: The operation failed" on the following line....
Set objEmail = objOutlook.CreateItem(olMailItem)
Here is the whole procedure...
Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
Can anyone help??
Thanks,
Brad