Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21266

Shell Email Message

$
0
0
I'm shelling to my vb6 application from Excel so the users email compose window opens ready for Sending.

My project has

Name:  Image1.jpg
Views: 10
Size:  28.6 KB

The code is:

Code:


  Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hWnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, _
    ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long

Private Const SW_SHOWNORMAL = 1


Sub Main()
frmInfo.Hyperlink1_Jump
End
End Sub

Sub Hyperlink1_Jump()

  If InStr(command, "[") > 0 And InStr(command, "") > 0 Then
    Dim address As String
    Dim subject As String
    Dim body As String
    Dim email As String
   
    address = "mailto:britburn@gmail.com"
    subject = "?subject=" & "User Update"
    body = "&body=" & Replace(command, Chr$(34), Chr$(254))
    email = address & subject & body
        ShellExecute Me.hWnd, "Open", email, "", "C:\", SW_SHOWNORMAL
  Else
        ShellExecute Me.hWnd, "Open", command, "", "C:\", SW_SHOWNORMAL
  End If
End sub

This works well (after excluding any problem characters from command first) except
under one condition. When body is longer than 1983 characters, the email window never appears.

I presume this is some kind of size limitation transferring the data to the email program.

What would be the best solution or workaround for this ? The size for body is known but
would be difficult to split. Maybe it could attached as a txt file, rather than part of the body?
(But I don't know how to do this)

Thanks for any help, ABB
Attached Images
 

Viewing all articles
Browse latest Browse all 21266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>