Has anyone encountered a string length limit when using VBA Excel to
generate and send e-mail messages using Outlook Express? I'm using the
following code...
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory
As String, _
ByVal nShowCmd As Long) As Long
Dim Msg as string
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString,
vbNormalFocus
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%s"
Where Msg is a string that makes up the body of the e-mail.
When the Msg string is relatively short (such as 1,577 characters
including spaces) the shell works with no problem. But when the Msg
string is longer (such as 2,593 characters), outlook doesn't send the
e-mail. No error messages - it just doesn't send. The length of a
string that won't work is well within the VBA limits and I've printed
the longer strings to a cell to confirm that they aren't being clipped
in some way.
I'm guessing that this is an Outlook Express limit, rather than a VBA
limit, but I can't find anything in the Outlook Express help that
describes this functionality at all. Anyone have any suggestions on
increasing this apparent string limit?