Hi all

I'm using the below function, to open a new email message, and feed in an email address, subject and a 'body' of the email (Note I don't want to send an email, just open the message and paste in contents)...

VB Code:
  1. Public Function OpenEmail(ByVal EmailAddress As String, _
  2.     Optional Subject As String, Optional Body As String) _
  3.     As Boolean
  4.  
  5.     Dim lWindow As Long
  6.     Dim lRet As Long
  7.     Dim sParams As String
  8.      
  9.     sParams = EmailAddress
  10.     If LCase(Left(sParams, 7)) <> "mailto:" Then _
  11.         sParams = "mailto:" & sParams
  12.  
  13.  If Subject <> "" Then sParams = sParams & "?subject=" & Subject
  14.          
  15.     If Body <> "" Then
  16.         sParams = sParams & IIf(Subject = "", "?", "&")
  17.         sParams = sParams & "body=" & Body
  18.     End If
  19.  
  20.    lRet = ShellExecute(lWindow, "open", sParams, _
  21.     vbNullString, vbNullString, SW_SHOW)
  22.      
  23.    OpenEmail = lRet = 0
  24.  
  25. End Function


The problem is, I want to feed a 'body' of text that includes returns after each line of text. As it stands, it just feeds one long line of text, containing company name, phone number etc. I've tried VbCrlF, Sendkeys to send tabs to the email message etc, nothing seems to work.

It just pastes a huge long line of information. I've tried putting vbCrLF's at the end of the strings that are grouped together (with '&') to form the final body string etc, no go...

Any ideas? I'm using VB5 to do this.