macro for reading outlook mails and printing them in the textbox
Hi all
First time I am writing a macro and I have to write a macro so that I can read the my outlook mail body and copy it in textbox in the dashboard. I wrote the following macro, however it is giving error and not working
sub SELECT_OT
Set myApp = CreateObject ("Outlook.Application")
Set session = myApp.getnamespace("mapi") Set myMessage = myApp.CreateItem(olMailItem) myMessage.BodyFormat = 3 'Outlook.OlBodyFormat.olFormatRichText session.logon Set inbox = session.getdefaultfolder(6) c = 0 For Each m In inbox.items If m.subject = "GEODIS -mandatory training" then m.display go = myMessage.Body myMessage.Display end if Next ActiveDocument.GetSheetObject("TX111").Write = go Set myMessage = Nothing
Set myApp = Nothing Set myInspector = Nothing Set myDoc = Nothing
ActiveDocument.Fields("Code C@pplis").Clear ActiveDocument.Fields("Template").Clear ActiveDocument.Fields("Techno").Clear End sub