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: 1
Default email help please!!


Private Sub ContinueButton_Click()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem

Unload EmailProgress
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
On Error GoTo cleanup
With OutMail
.To = Sheets("Email").Cells(1, 2).Value
.Subject = emSubject
.Body = emBody
i = 1
Do While Sheets("Email").Cells(i, 3) < "" And i < 10
.Attachments.Add Sheets("Email").Cells(i
3).Value
i = i + 1
Loop
.Send
End With

' rename emailed files from SEND to SENT
i = 1
Do While Sheets("Email").Cells(i, 3).Value < "" And i < 20
SaveIt = Sheets("Email").Cells(i, 3).Value
emName = Replace(Sheets("Email").Cells(i, 3).Value
"Send", "Sent")
Name SaveIt As emName
i = i + 1
Loop
cleanup:
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub


This code sends multiple txt files as attachments to one email and the
moves the files to a different folder. It works except for th
following. If Outlook is already running at the time, the Outloo
window opens and the email is sent. It does not return to excel. I hav
to click on excel in the taskbar to reenter my program. As you ca
probably guess the email process works ok if Outlook is not alread
running except I never lose control of the screen. Is there a way t
stop the required manual interventiion?? As a side note, the "sendin
message in your behalf" Outlook message is automatically clicked yes b
the resident ClickYes utility. Thanks
Edit/Delete Messag

--
ricksim
-----------------------------------------------------------------------
ricksimm's Profile: http://www.excelforum.com/member.php...fo&userid=2189
View this thread: http://www.excelforum.com/showthread.php?threadid=38475

 
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
Using Macro how to create email link for the email addresses in aRange or Selection Satish[_2_] Excel Worksheet Functions 8 December 28th 09 03:30 PM
send wkbk as an email attachment with an email address copied from SueInAtl Excel Discussion (Misc queries) 0 May 21st 07 10:53 PM
can I copy a column of email addresses, paste into email address? Lizizfree New Users to Excel 4 July 20th 06 10:03 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM
Email editor closes when forwarding Excel-embedded email Bambina Setting up and Configuration of Excel 0 March 16th 06 10:45 PM


All times are GMT +1. The time now is 11:50 PM.

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"