|
-
Sep 21st, 2001, 06:05 AM
#1
Thread Starter
Junior Member
using the shell to popup default email client
Hi,
I have a button on my form that when clicked it pops-up the default email client with a few of it's field filled such as "Subject" and "body".
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
Private Sub Send_Click()
Dim l As Long
l = ShellExecute(Me.hwnd, "Open", "mailto:?Subject=Hello&Body=Thought you would like to download this ." + Chr(13) + "PC users here - download the file to your desktop and start using. ", "", "C:\", SW_SHOWNORMAL)
End Sub
The problem is that I would like to format the text in the body of the message but do not know what character to insert in order to get sentences on new lines in the body section. I tried using Chr(13) also "\n" and "\r" but none of them worked.
I am assuming that most of the users will have Outlook or Outlook Express as their email client and was wondering if anyone could help me find out how to do it.
Thank you
Why did I ever start learning VB?! I should have been happy with Java. 
-
Sep 21st, 2001, 06:19 AM
#2
Addicted Member
-
Sep 21st, 2001, 07:04 AM
#3
I believe he means vbCrLf
I've done similiar things, and have discovered that if I use a Richtextbox for my users to create the message that my code will pop into the message area of an EMail, I have a lot more formatting options that just using a standard text box.
Richtextboxes support a lot more features than a standard, such as carriage return/line feeds, bolding, etc.
-
Sep 21st, 2001, 07:13 AM
#4
Addicted Member
Originally posted by Hack
I believe he means vbCrLf
Well actually no, I use just plain CRLF and it works, is there any difference between the 2 or should I just put the VB infront for best practice reasons?
-
Sep 21st, 2001, 10:21 AM
#5
Thread Starter
Junior Member
none of the suggested characters worked. It sounds like a sound ideea to use a a Richtextbox but the text is not going to be typed by the user. It is preset text. Please help as I have the deadline for Monday. Cheers
Why did I ever start learning VB?! I should have been happy with Java. 
-
Sep 21st, 2001, 10:23 AM
#6
PowerPoster
Well, you could always load it into a regular textbox with multiline set to true. You could then hide the textbox from the user by setting it's visible property to false. Then, you could just load it in.
-
Sep 21st, 2001, 10:37 AM
#7
Thread Starter
Junior Member
I tried it but it does not work. How do I get Richtextbox into my project?
Why did I ever start learning VB?! I should have been happy with Java. 
-
Sep 21st, 2001, 10:38 AM
#8
PowerPoster
Right-click on your toolbox. Select Components..., and check off MS RichEdit (something like that, forgot exact name).
Then, click OK.
-
Sep 21st, 2001, 10:51 AM
#9
Thread Starter
Junior Member
i set the Text of the control to "blablabla"+ vbCrLf +"blablabla" and when I popup the email client (Outlook Express) i use RichEdit1.Text as the body of the message and it all appears on only one line. Is it possible for you to show me what string you would set the Rich edit text to? Thanks
Why did I ever start learning VB?! I should have been happy with Java. 
-
Sep 21st, 2001, 10:54 AM
#10
PowerPoster
...I would use the & operator instead of the + operator.
-
Sep 21st, 2001, 10:54 AM
#11
PowerPoster
Does changing the constant to vbNewLine work?
-
Sep 21st, 2001, 11:02 AM
#12
Thread Starter
Junior Member
still no luck. I do not understand why
Why did I ever start learning VB?! I should have been happy with Java. 
-
Sep 21st, 2001, 11:02 AM
#13
PowerPoster
Me neither...
-
Oct 9th, 2001, 05:23 PM
#14
Lively Member
Solution
This thread is a bit old but I found the solution for your (and my) problem.
Code:
'****************************************************************************
'
' PUBLIC CONSTANT FOR A LINE BREAK IN SHELLEXECUTE-
' GENERATED EMAIL USING HEX VALUES
'****************************************************************************
Public Const mailNewLine = "%0D%0A"
just use the mailNewLine like you would vbCrLf ("blah" & mailNewLine & "blah")
-
Oct 10th, 2001, 04:42 AM
#15
Thread Starter
Junior Member
thanks, I just about managed to find it also.I think I was looking in the wrong place(VB documentation) when that character is a "mailto" protocol!?
On the Netscape site I only found "%0A" as a new line. What is the other character "%0D"?
Why did I ever start learning VB?! I should have been happy with Java. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|