Outlook macros

nagu_flex

New Member
Joined
Jul 19, 2006
Messages
33
Hi Everybody!!

I need some macros for outlook.

Everyweek i have to send a mail to my clients around 250+ clients. Is there any way to genrate auto mail via macros.

I have list of mails in excel. Body of msgs are same.

If anybody suggest me to go shortcut via macro. They are highly appreceiated.

Thanks in advance.

Best Regds.
Nagu.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Darren Bartrup

Well-known Member
Joined
Mar 13, 2006
Messages
1,296
Office Version
  1. 365
Platform
  1. Windows
Hi Nagu,

This method works in Excel, so I guess it works just as well in Access:

In the Visual Basic Editor set a reference to the Microsoft Outlook 10.0 Object Library (or the most upto date Outlook Library you have).
Rich (BB code):
Public Sub CreateEmail()

    Dim objApp  As Outlook.Application
    Dim objMail As MailItem
    
    On Error Resume Next
        Set objApp = GetObject(, "Outlook.Application")
    On Error GoTo 0
    
    If TypeName(objApp) = "Nothing" Then
        Set objApp = CreateObject("Outlook.Application")
    End If
    
    Set objMail = objApp.CreateItem(olMailItem)
    With objMail
        .To = "To email address"
        .CC = "CC email address"
        .Body = "This is the body of the text"
        'OR
        '.HTMLBody = "This is formatted body in bold"
        '.Attachments.Add "full path to attachment 1"
        '.Attachments.Add "full path to attachment 2"
        .Subject = "Subject heading"
        '.Save   'Save to draft folder
        '.Send   'Send email.
    End With
    
    Set objMail = Nothing
    Set objApp = Nothing

End Sub
I haven't tested the code, just taken out the bits I need from one of my procedures.

Edit: Hmmm, for some reason I thought I was in the Access forum... not general discussion. Not sure if this will work at all now :oops:
Obviously don't need to set a reference to Outlook if it's running in Outlook and Outlook doesn't use VBA, but VB Script.... ignore this post, it's rubbish.
 

ryancey

New Member
Joined
Oct 11, 2005
Messages
46
Thanks!

Hey guys,
I'm a novice at this stuff and found your posting. I looked up in outlook and saw how to add the outlook reference library and then used your code. It's awesome! I added some variables so that I can run down a list and send different files to lots of different people. Its really cool.
Later...
 

Forum statistics

Threads
1,136,262
Messages
5,674,709
Members
419,521
Latest member
Jasonnie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top