I am struggling with loosing my carriage returns in my string variable. I am sending an e-mail and want the body to display:
1
2
3
Instead, the body displays:
123
I have tried loading my variable these ways:
TO = "who@what.com"
WHAT = "Something for review.."
BODY = "1" & vbnewline & "2" & vbnewline & "3"
TO = "who@what.com"
WHAT = "Something for review.."
BODY = "1" & chr(13) & "2" & chr(13) & "3"
gsystem.sendmail TO,WHAT,BODY
I check BODY in the immediate window all the way untill it is executed by RunShellExecute in the SendEmail Sub in my Class Module. It is displaying correctly until it hits this then it loses its carriage returns.
Any ideas would be helpful! Thanks. JPM
Here is my Class Module that I am calling:
Public Sub SendEmail(sTo As String, sSubject As String, sBody As String)
' ------------------------------------------------------------
'Scope: Public
'Purpose: Opens the default web browser's mail program with the To:,Subject, and body filled in.
'Required:
'sTo - the e-mail address to whom you are sending mail
'sSubject - the subject line of the e-mail
'sBody - You get the idea...
'Useage:
'SendEmail "who@what.com", "This is the subject", "Here is the BODY!"
'** User is able to add to the body of the email detailing other information.
' ------------------------------------------------------------
Dim sTopic As String
Dim sFile As String
Dim sParams As Variant
Dim sDirectory As Variant
sTopic = "Open"
sFile = "mailto:" & sTo & "&Subject=" & sSubject & "&Body=" & sBody
sParams = 0&
sDirectory = 0&
Call RunShellExecute(sTopic, sFile, sParams, sDirectory, SW_SHOWNORMAL)
End Sub
Public Sub RunShellExecute(sTopic As String, sFile As Variant, _
sParams As Variant, sDirectory As Variant, nShowCmd As Long)
' ---------------------------------------------------------------------
' This Public Sub is used to launch the default e-mail program and
' default Web Browser
' ---------------------------------------------------------------------
Dim hWndDesk As Long
Dim success As Long
' -------------------------------
' Executes the passed operation
' -------------------------------
success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd)
End Sub
1
2
3
Instead, the body displays:
123
I have tried loading my variable these ways:
TO = "who@what.com"
WHAT = "Something for review.."
BODY = "1" & vbnewline & "2" & vbnewline & "3"
TO = "who@what.com"
WHAT = "Something for review.."
BODY = "1" & chr(13) & "2" & chr(13) & "3"
gsystem.sendmail TO,WHAT,BODY
I check BODY in the immediate window all the way untill it is executed by RunShellExecute in the SendEmail Sub in my Class Module. It is displaying correctly until it hits this then it loses its carriage returns.
Any ideas would be helpful! Thanks. JPM
Here is my Class Module that I am calling:
Public Sub SendEmail(sTo As String, sSubject As String, sBody As String)
' ------------------------------------------------------------
'Scope: Public
'Purpose: Opens the default web browser's mail program with the To:,Subject, and body filled in.
'Required:
'sTo - the e-mail address to whom you are sending mail
'sSubject - the subject line of the e-mail
'sBody - You get the idea...
'Useage:
'SendEmail "who@what.com", "This is the subject", "Here is the BODY!"
'** User is able to add to the body of the email detailing other information.
' ------------------------------------------------------------
Dim sTopic As String
Dim sFile As String
Dim sParams As Variant
Dim sDirectory As Variant
sTopic = "Open"
sFile = "mailto:" & sTo & "&Subject=" & sSubject & "&Body=" & sBody
sParams = 0&
sDirectory = 0&
Call RunShellExecute(sTopic, sFile, sParams, sDirectory, SW_SHOWNORMAL)
End Sub
Public Sub RunShellExecute(sTopic As String, sFile As Variant, _
sParams As Variant, sDirectory As Variant, nShowCmd As Long)
' ---------------------------------------------------------------------
' This Public Sub is used to launch the default e-mail program and
' default Web Browser
' ---------------------------------------------------------------------
Dim hWndDesk As Long
Dim success As Long
' -------------------------------
' Executes the passed operation
' -------------------------------
success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd)
End Sub