On 5 Sep 2004 22:13:00 -0700,
br********@gmail.com (Branden) wrote:
Yes, you'll have to write some VBA code to parse the Body text.
Assuming this is your body text:
FirstName: Tom<CRLF>
LastName: van Stiphout<CRLF>
<etc>
Note that <CRLF> stands for a carriage return / linefeed pair of
characters, the typical (invisible) separator characters between two
lines of text.
Now write code like this (note: air code ahead):
Sub WriteBodyToDb(byval strBody as string)
dim strFirstName as string
dim strLastName as string
strFirstName=GetFieldValue(strBody, "FirstName: ")
strLastName=GetFieldValue(strBody, "LastName: ")
'etc.
'TODO: Write the values to the Db. Perhaps using a recordset, or an
Append query.
end sub
private function GetFieldValue(byval strBody as string, byval
strFieldHeader as string)
dim intStartOfField as integer
dim strField as string
intStartOfField=GetStartOfFieldValue(strBody, strFieldHeader)
if intStartOfField>0 then
strField=Mid$(strBody, intStartOfField, Instr(intStartOfField,
strBody, vbCrLf))
GetFieldValue=strField
end function
private function GetStartOfFieldValue(byval strBody as string, byval
strFieldHeader as string)
dim intPos as integer
intPos=instr(strBody, strFieldHeader)
if intPos>0 then intPos=intPos+len(strFieldHeader)
GetStartOfFieldValue=intPos
end function
Happy coding!
-Tom.
hi guys,
i was wondering if it is possible to extract selected words in a
field to be put in different fields automatically. Do i have to write
the code in vb?
This is what im trying to do. Write now, i have emails that i
receive in outlook and i want to transfer them into a database. I
realized that i could export this. however, the BODY section of the
email is exported as one field. As the email i receive is a template
and it is always in a specific form. Is there anyway i can extract the
data and place them into different fields?
Thanks.