Extracing out data to save into a word file or excel file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I work for a company that receives auto receipts for work that has been
processed and properly ingested. My question for you, is there a way for a
specific line of data to be extracted out and dropped into a XLS file or a
word doc? There is always going to be a line of data called "Summary report:"
the information that I need is contained directly after this line, there is
also always going to be in the subject line the word "receipt". I can of
course set up a folder for these but to extract the data out is where I am
running into problem. Please help if you can. Thanks.
 
' Startposition of ,"summary report:" if it is unique, regardless of
lower or upper characters:

posStart=InStr(1,mailitem.body,"summary report:",vbtextcompare)

' Setting the pos to the end of the searched string:

posStart=posStart+len("summary report:")

' Looking for the end after the searched string if this end is signed
e.g. by a "return":

posEnd=InStr(posStart,mailitem.body,vbcrlf,vbtextcompare)

' Extracting the string between start and end position:

res$=mid$(mailitem.body,posStart,posEnd-posStart)
 
Back
Top