View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams[_4_] Tim Williams[_4_] is offline
external usenet poster
 
Posts: 114
Default Help with Macro please...

Your code works for me in that it will fetch the body of all the
messages selected in my outlook inbox.

So, if you're not getting any data the problem must be in your parsing
code.
Hard to tell without a sample message to look at.

Comment on this:

Tabl = Split(mybody, Chr(10))
For Each Item In Tabl
Item = Replace(Item, Chr(10), "") '**** not required
Item = Application.Clean(Item)
Next Item

If you've split the text into lines on Chr(10), there should be no Chr
(10) in any of the lines, so you can omit that line.

You might also consider splitting out the "search" part into a
separate function

Function GetValue(arrLines, LookFor As String) As String
Dim x As Integer
Dim rv As String, line As String

rv = ""
For x = LBound(arrLines) To UBound(arrLines)
line = arrLines(x)
If LCase(line) Like LookFor & "*" Then
rv = Mid(line, Len(LookFor) + 4, 999)
Exit For
End If
Next x
GetValue = rv

End Function

Call using something like:

tmp = GetValue(Tabl,"first name")
.Cells(2).value = Application.Proper(tmp)

If you could post an example (altered if required) of a typical
message body that would help.

Tim

On Dec 15, 2:53*pm, Monomeeth
wrote:
Hi Tim

Thanks for the suggestion. I removed it and there was no noticeable
difference - exactly the same result.

I don't suppose you'd have any other ideas?

Joe.
--
If you can measure it, you can improve it!



"Tim Williams" wrote:
What happens if you remove the "On Error Resume Next" ?


Tim


"Monomeeth" wrote in message
...
Oops, forgot to mention that I have tried selecting messages in Outlook
before running the Macro in Excel, but this seems to have no effect. Not
selecting any messages beforehand also has no effect.


.- Hide quoted text -


- Show quoted text -