?
Solved

How do you put a variable in a  shell command line?

Posted on 2007-11-28
3
Medium Priority
?
183 Views
Last Modified: 2010-04-23
Shell("C:\Program Files\Microsoft Office\Office11\Outlook.exe /c ipm.note /m mailto:name@comcast.net&subject=Retrofits%21&body=txtRetrofitPartNumber.text")

I have the above command line in a Visual Basic Button_Click event.  When I click the button a pre-addressed, pre-formatted new e-mail message pops up. To: name@comcast.net, Subject: Retrofits.  This is what I want so far.  In the body I have the literal txtRetrofitPartNumber.text. n my program that is a variable.  It is a textbox that the text will change from time to time.  I want my e-mail to have the text that was typed into txtretrofitPartNumber.text not the literal "txtRetrofitPartNumber.text"  Any ideas how to do that?
0
Comment
Question by:markleszczynski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Expert Comment

by:jcoehoorn
ID: 20369712
Shell("C:\Program Files\Microsoft Office\Office11\Outlook.exe /c ipm.note /m mailto:name@comcast.net&subject=Retrofits%21&body=" & txtRetrofitPartNumber.text)

That was the simple answer.  The complete answer is that Shell is included for compatibility with VB6, and you should really move on to using System.Diagnostics.Process()  (or just Process() ) instead.  Then build the string like I show above.
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 1000 total points
ID: 20369721
Shell("C:\Program Files\Microsoft Office\Office11\Outlook.exe /c ipm.note /m mailto:name@comcast.net&subject=Retrofits%21&body="+ txtRetrofitPartNumber.Text)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20369751
notice your text should be very short and simple. Will be better if you use UrlEnconding to avoid invalid characters in body text:

Shell("C:\Program Files\Microsoft Office\Office11\Outlook.exe /c ipm.note /m mailto:name@comcast.net&subject=Retrofits%21&body=" & _
System.Web.HttpUtility.UrlEncode(txtRetrofitPartNumber.Text))
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question