A
AccessHelp
I submitted the same tread a few weeks ago. As of today, I have not found a
solution for the problem. I hope one of you had the same experience in the
past and would like to share with me on the solution of the problem.
Basically, I use the code from Ron (see below) to email an Excel sheet using
Microsoft Outlook. Everyone in the company who uses this code has no problem
using it, except one person. Everytime, he uses it on his computer he
receives an automation error (Runtime error: 2147024770(8007007e)). When I
debugged it, it pointed me to the code "Set OutApp =
CreateObject("Outlook.Application")".
When I ask him to send me his file (so that I can try it on my computer) and
when I try it on my computer, I don't have any problem.
I checked "References" in VBA on his computer, and he has all the references
that I use. I also tried to submit the sheet when the Outlook is opened, and
I still had problem.
I know the problem is on his computer, not the code. I am trying to figure
out what he is missing on his computer to trigger that problem.
Any help is appreciated.
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add wb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing
solution for the problem. I hope one of you had the same experience in the
past and would like to share with me on the solution of the problem.
Basically, I use the code from Ron (see below) to email an Excel sheet using
Microsoft Outlook. Everyone in the company who uses this code has no problem
using it, except one person. Everytime, he uses it on his computer he
receives an automation error (Runtime error: 2147024770(8007007e)). When I
debugged it, it pointed me to the code "Set OutApp =
CreateObject("Outlook.Application")".
When I ask him to send me his file (so that I can try it on my computer) and
when I try it on my computer, I don't have any problem.
I checked "References" in VBA on his computer, and he has all the references
that I use. I also tried to submit the sheet when the Outlook is opened, and
I still had problem.
I know the problem is on his computer, not the code. I am trying to figure
out what he is missing on his computer to trigger that problem.
Any help is appreciated.
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add wb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing