Hello,
I'm using Outlook 2013 and trying to create a macro which extracts (only) the sender name and subject line of new incoming emails to/on top of one/single .txt file. If a new incoming email arrives the sender and subject line are added on top of the same/existing .txt file, stored on my PC. Outlook will be running in the background. I'm struggling to get newly arriving emails selected for execution of the macro.
I have tried/combined some of the many samples on this homepage but still struggle to get a macro that extracts the sender and subject of the latest incoming emails on top of one/single .txt file. Below some parts of code which I would like to work with.
////////
sName = "MailExtract" strFile = "c:\path\" & sName & ".txt" .Write "Sender: " & objItem.Sender & vbCrLf .Write "Subject: " & objItem.Subject & vbCrLf & vbCrLf
////////
Any advice will be highly appreciated. As alternative to macro I was looking into executing a script (via rule) but it seems to be more difficult to extract/copy/paste sender/subject lines from incoming emails.
I am aware there might be issues e.g. when receiving 2 or more emails within short period of time. However, this is not a major concern and i would be happy if sender name/subject of at least 1 newly arriving email could be extracted to txt file.
My final goal: I have a VB program/.exe serial port communication tool created which does every 1 or 2 minutes load 1 line for sender and 2nd line for the subject to individual text boxes. From there it is send via serial to a connected bluetooth receiver/port which is connected to a LED Matrix display which will show latest/newest sender/subject line mentioned on top of the .txt file.
Thanks in advance for any advice.
Kind Regards,
Chris
I'm using Outlook 2013 and trying to create a macro which extracts (only) the sender name and subject line of new incoming emails to/on top of one/single .txt file. If a new incoming email arrives the sender and subject line are added on top of the same/existing .txt file, stored on my PC. Outlook will be running in the background. I'm struggling to get newly arriving emails selected for execution of the macro.
I have tried/combined some of the many samples on this homepage but still struggle to get a macro that extracts the sender and subject of the latest incoming emails on top of one/single .txt file. Below some parts of code which I would like to work with.
////////
sName = "MailExtract" strFile = "c:\path\" & sName & ".txt" .Write "Sender: " & objItem.Sender & vbCrLf .Write "Subject: " & objItem.Subject & vbCrLf & vbCrLf
////////
Any advice will be highly appreciated. As alternative to macro I was looking into executing a script (via rule) but it seems to be more difficult to extract/copy/paste sender/subject lines from incoming emails.
I am aware there might be issues e.g. when receiving 2 or more emails within short period of time. However, this is not a major concern and i would be happy if sender name/subject of at least 1 newly arriving email could be extracted to txt file.
My final goal: I have a VB program/.exe serial port communication tool created which does every 1 or 2 minutes load 1 line for sender and 2nd line for the subject to individual text boxes. From there it is send via serial to a connected bluetooth receiver/port which is connected to a LED Matrix display which will show latest/newest sender/subject line mentioned on top of the .txt file.
Thanks in advance for any advice.
Kind Regards,
Chris