Sub Test() MsgBox("Hello world") End Sub Sub try() Dim ContactsFolder As Folder Set ContactsFolder = Session.GetDefaultFolder(olFolderContacts) For Each Contact In ContactsFolder.Items Debug.Print Contact.CompanyName Next MsgBox ("Hello world") End Sub Sub bb() Dim str_file As String str_file = "C:\cygwin\home\pinhask\Private\" Dim ib_ml As Folder Set ib_ml = Session.GetDefaultFolder(olFolderInbox) For Each ml In ib_ml.Items If ml.UnRead Then MsgBox ml.Subject MsgBox ml.SenderName MsgBox ml.Body MsgBox ml.ReceivedTime ml.SaveAs str_file & ml.Subject & ".txt", olTXT End If Next MsgBox ("end macro") End Sub Sub bb() Dim str_file As String Dim str_date As String str_file = "C:\cygwin\home\pinhask\Private\" Dim data_a As Variant Dim data_i As Integer Dim ib_ml As Folder Set ib_ml = Session.GetDefaultFolder(olFolderInbox) For Each ml In ib_ml.Items If ml.UnRead Then MsgBox ml.Subject MsgBox ml.SenderName MsgBox ml.Body MsgBox ml.ReceivedTime data_a = Split(ml.ReceivedTime, "/") data_i = UBound(data_a) For I = 0 To data_i MsgBox data_a(I) If I < 2 Then str_date = str_date & data_a(I) & "_" End If Next I MsgBox str_date MsgBox Format(Now(), "hh mm ss") ml.SaveAs str_file & "ML_" & str_date & ml.Subject & ".txt", olTXT End If Next MsgBox ("end macro") End Sub Sub bb() Dim str_file As String Dim str_date As String str_file = "C:\cygwin\home\pinhask\Private\" Dim data_a As Variant Dim data_i As Integer Dim ib_ml As Folder Set ib_ml = Session.GetDefaultFolder(olFolderInbox) For Each ml In ib_ml.Items If ml.UnRead Then str_date = Format(Now(), "hh mm ss") str_date = Replace(str_date, " ", "_") '// replace spaces ml.SaveAs str_file & "ML_" & str_date & "_" & ml.Subject & ".txt", olTXT End If Next End Sub ****examples**** Dim strPrompt As String strPrompt = "Are you sure you want to save the item? If a file with the same name already exists, it will be overwritten with this copy of the file." If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then objItem.SaveAs "C:\" & strname & ".txt", olTXT End If Console.WriteLine(i) Console.WriteLine(oMsg.SenderName) Console.WriteLine(oMsg.Subject) Console.WriteLine(oMsg.ReceivedTime) Console.WriteLine(oMsg.Body) Console.WriteLine("---------------------------") End If Next ' StreamWriter is a useful class for writing text to files Dim writer As New StreamWriter(path & "\test.txt") ' WriteLine writes a value to the file and moves to the next line writer.WriteLine("line one") writer.WriteLine("line two") ' Write writes a value to the file and does not move to the next line writer.Write("All") writer.Write(" on ") writer.Write(1) writer.Write(" line.") ' Always close the file when you are done with it. If you do not do this, ' your data may not be saved and other programs might not be able to use ' the file until you reboot! writer.Close() Sub ConvertToPlain(MyMail As MailItem) Dim strID As String Dim objMail As Outlook.MailItem strID = MyMail.EntryID Set objMail = Application.Session.GetItemFromID(strID) objMail.BodyFormat = olFormatPlain objMail.Save Set objMail = Nothing End Sub Sub scr_save(MyMail As MailItem) Dim strID As String Dim objMail As Outlook.MailItem strID = MyMail.EntryID Set objMail = Application.Session.GetItemFromID(strID) objMail.BodyFormat = olFormatPlain Dim str_file As String Dim str_date As String str_file = "C:\cygwin\home\pinhask\Private\" Dim str_sub As String str_date = Format(Now(), "hh mm ss") str_date = Replace(str_date, " ", "_") '// replace spaces objMail.SaveAs str_file & "ML_" & str_date & "_" & objMail.Subject & ".txt", olTXT End Sub