I am having problems automatically exporting the body of a message to a text file using a script. I managed to create a script that will save the text in a file on a macro, but this will not work on the rule that I need.
My current code is as follows:
Sub SaveAsTXT()
Dim myItem As Outlook.Inspector
Dim objItem As Object
Dim myFolder As Folder
Set myItem = Application.ActiveInspector
If Not TypeName(myItem) = "Nothing" Then
Set myNamespace = Application.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
Set objItem = myItem.CurrentItem
strname = objItem.Subject
strdate = Format(objItem.ReceivedTime, " yyyy mm dd")
objItem.SaveAs "c:\users\philip\documents\" & strname & strdate & ".txt", olTXT
End If
End Sub
Sorry if it looks a little dirty, I edited it countless times, trying to get it to work.
What is the code that will execute correctly when I am in an open message and run it as a macro, but it will not work correctly when I start it? As a rule, I tried to make changes to it Sub SaveAsTXT(Item as Outlook.Mailitem), but it also doesn’t work
, , , ( "Rotas" ), ?
: Office 2010 .