Hi Guys,
I have a lot of emails with txt attachments that I need to handle every day. I select the message, open the attachement in notepad (without saving) and then manually paste it to excel workbook. I want to be able when I open the attachment that it is automatically loaded in this excel workbook. What I managed to do now is that when I save the file to my desktop I can open it from excel. But I want to do this with each opened txt file. Is there a way to do this in Outlook vba?
I have a lot of emails with txt attachments that I need to handle every day. I select the message, open the attachement in notepad (without saving) and then manually paste it to excel workbook. I want to be able when I open the attachment that it is automatically loaded in this excel workbook. What I managed to do now is that when I save the file to my desktop I can open it from excel. But I want to do this with each opened txt file. Is there a way to do this in Outlook vba?
Sub ImportText()
Set myPlace = ActiveCell
Workbooks.OpenText _
Filename:=ActiveWorkbook.Path & "\MYFILE.txt", _
DataType:=xlDelimited, Tab:=True
ActiveSheet.UsedRange.Copy Destination:=myPlace
ActiveWorkbook.Close
End Sub
I want to trigger the macro each time I open txt file from Outlook. Can this be accomplished? Thank you very much in advance!Set myPlace = ActiveCell
Workbooks.OpenText _
Filename:=ActiveWorkbook.Path & "\MYFILE.txt", _
DataType:=xlDelimited, Tab:=True
ActiveSheet.UsedRange.Copy Destination:=myPlace
ActiveWorkbook.Close
End Sub