Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using Macro how to create email link for the email addresses in aRange or Selection | Excel Worksheet Functions | |||
send wkbk as an email attachment with an email address copied from | Excel Discussion (Misc queries) | |||
can I copy a column of email addresses, paste into email address? | New Users to Excel | |||
Transfer Email addresses from spreadsheet to email address book | Excel Discussion (Misc queries) | |||
Email editor closes when forwarding Excel-embedded email | Setting up and Configuration of Excel |