View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
p[_2_] p[_2_] is offline
external usenet poster
 
Posts: 6
Default Vba - Generating Micr Outlook Alert from excel

Ajliak,

modify the code below:

Function SendMail(EmailAddressTo, EmailAddressBCC, BodyText, FileToAttach,
Optional AttachmentTitle, Optional CounterNo, Optional MessageTitle)
Dim myOlApp, MyItem, myAttachment
Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItem(olMailItem)
With MyItem
.To = EmailAddressTo
.BCC = EmailAddressBCC
.Subject = MessageTitle ' & " - CounterNo " & CounterNo
.Body = Chr(13) & Chr(13) & BodyText
End With

'myItem.Display

On Error Resume Next
If FileToAttach < "" Then
Debug.Print "FileToAttach: " & FileToAttach & " -
AttachmentTitle: " & AttachmentTitle & " - CounterNo " & CounterNo
Set myAttachment = MyItem.Attachments
myAttachment.Add FileToAttach, , 2, AttachmentTitle
End If

With MyItem
'.Send
.Save
.Close
'.MoveTo MyOutBoxFolder ' another function
End With

DoEvents
Sleep 500
Set myOlApp = Nothing
Set MyItem = Nothing
Set myAttachment = Nothing

MoveToOutBoxFolder ' another function

End Function
"ajliaks " wrote in message
...
Hi all,
It may be simple, but I have no idea how to do this!
Could somebody help, please?

From excel macro, I need to generate event in Microsoft Outlook, e.g.:

If today=12-08-2004 then

Outlook.task = "Make a cake"
Outlook.Note="Happy birthday"
Outlook.Calendar=Appointment in place... at 15.30 hs

end if

Any help will be really appreciate!
Aldo.


---
Message posted from http://www.ExcelForum.com/