Integrating excel & outlook

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello Team ,

Iam trying to integrate excel macro and outlook .Once i click the macro , the macro should sort the data BU wise . There are 11 tabs for each 6 BU's in one excel workbook .Will you be able to give me a skeleton of the code for me? After the macro sperates the BU ise information it should save it in the name of the BU for which the information was extracted .After that it should get attached to the outlook and also the mailing list should get populated .

Please help .........

Job at stake .

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Corrected an error

DISCLAIMIER: I HAVE NOT TESTED IT

Some thing like this


Sub ShootANote() 
Dim ObjOutLook As Object 
Dim objMail As Object 
Dim olMailItem As Variant 

Dim SendTo As String 
Dim Subject As String 
Dim Body As String 
Dim CC As String 
Dim Attachment As String 

    Set ObjOutLook = New Outlook.Application 
    Set objMail = ObjOutLook.CreateItem(0) 
     
    SendTo = "Bill.Gate@microsoft.com, SomeOne@SomeWhere.Com" 
    Subject = "Email Works ?" 
    CC = "Yes@No.net" 
    Attachment = "C:\myPornCollection.zip" 
    Body = "Dear Some one" & Chr(13) & vbCrLf & " How is life" 
     
    With objMail 
         
        .To = SendTo 
         
        If (CC <> "") Then .CC = "boss@boss.com" 
         
        .Subject = Subject 
         
        .Body = Body 
         
        if (Attachment <> ") then .Attachments.Add (Attachment) 

        .Display 
    End With 

     
    Set objMail = Nothing 
    Set ObjOutLook = Nothing 

End Sub