|
-
Oct 7th, 2005, 06:20 AM
#1
Thread Starter
New Member
Using VBA in Excel to send E-mails
Hi,
I'm currently trying to write a macro to send e-mails via Outlook using info in Excel. The following syntax used to work fine but I no longer have access to Outlook and need to re-write the macro to enable my procedure to use Groupwise instead :
Dim OutlookApp As New Outlook.Application
Dim OutMail As Outlook.MailItem
Sheets("Menu").Select
Application.ScreenUpdating = False
Application.StatusBar = "E_Mailing RFQs to Suppliers ..."
Sheets("DailyRFQs").Select
Set OutApp = CreateObject("Outlook.Application")
' On Error GoTo cleanup
For Each VCODE In Range("VCODE")
' If VCODE.Offset(0, 5).Value = "Y" Then
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = VCODE.Offset(0, 2).Value
.Subject = "RFQ: " & VCODE.Offset(0, 12).Value & " - " & VCODE.Value & " " & VCODE.Offset(0, 1).Value
.Body = vbNewLine & vbNewLine & _
"Dear " & VCODE.Offset(0, 3).Value & "," & vbNewLine & vbNewLine & _
"Body Text"
.Attachments.Add VCODE.Offset(0, 7).Value
.Attachments.Add VCODE.Offset(0, 8).Value
.Attachments.Add VCODE.Offset(0, 9).Value
.Attachments.Add VCODE.Offset(0, 11).Value
.Send 'Or use Display
.Display
VCODE.Offset(0, 9).Value = "YES"
End With
Set OutMail = Nothing
Else
VCODE.Offset(0, 9).Value = "NO"
End If
Next
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Any help would be greatly appreciated.
Greg Maloney
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|