LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default CreateObject("Outlook.Application")

Hi,

I have procedure for sending mail. The problem is that the procedure will
work the first time it is executed but not the second time then the third
time it will work but not the fourth time and so on.

The sendEmail procedure is below.

Any help will be very much appreciated!

Public Sub sendMail()
On Error Resume Next

Dim oLApp As Object
Dim eMail As Object
Dim thisWb As String


thisWb = ThisWorkbook.Path & "\" & ThisWorkbook.Name
Set oLApp = CreateObject("Outlook.Application")
Set eMail = oLApp.CreateItem(olMailItem)

With eMail
.To = "
.Subject = "some subject"
.Attachments.Add (thisWb)
.Display
End With

Set eMail = Nothing
Set oLApp = Nothing
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
CreateObject("Excel.Application") Olivia Towery Excel Worksheet Functions 4 June 12th 06 12:07 AM
CreateObject("InternetExplorer.Application") shart[_9_] Excel Programming 1 January 2nd 06 05:14 PM
Set OutApp = CreateObject("Outlook.Application") - Runtime error 429 Buffyslay Excel Programming 2 July 20th 05 05:06 PM
ASP: CreateObject("Excel.Application") IIS 6.0 Win2003 Mau[_2_] Excel Programming 0 July 20th 05 11:45 AM
CreateObject("Excel.Application") - Access denied Luca[_2_] Excel Programming 0 February 6th 04 01:21 PM


All times are GMT +1. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"