473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Sending Email and the lovely SendKeys command.

I would like to send email automatically via a command button. I have
accomplished this just fine through the following code: (Outlook
should already be open for reliable results)

Private Sub Command6_Click()
ReturnValue = Shell("Outlook.EXE", 1) ' Run Outlook
SendKeys "%(F)", True
SendKeys "W", True
SendKeys "M", True 'Open New Message
SendKeys "ra*********@harbornet.com", True '<-- Email Address
SendKeys "{TAB 2}", True
SendKeys "TestSubject", True '<-- Subject Line
SendKeys "{TAB}", True
SendKeys "Test Message", True '<-- Message Text
SendKeys "%(s)", True 'Send Message
End Sub

I have gone a little overkill with the sendkeys command (VB newbie).
Can any of you guru's step into my code so that it will place the
value of a text box rather than the values I have submited via
sendkeys for the email address, subjectline, and message text.

Your help is greatly appreciated.

Regards,
Jeremy
Nov 12 '05 #1
6 12159
Mr. Bungle wrote:
I would like to send email automatically via a command button. I have
accomplished this just fine through the following code: (Outlook
should already be open for reliable results)

Private Sub Command6_Click()
ReturnValue = Shell("Outlook.EXE", 1) ' Run Outlook
SendKeys "%(F)", True
SendKeys "W", True
SendKeys "M", True 'Open New Message
SendKeys "ra*********@harbornet.com", True '<-- Email Address
SendKeys "{TAB 2}", True
SendKeys "TestSubject", True '<-- Subject Line
SendKeys "{TAB}", True
SendKeys "Test Message", True '<-- Message Text
SendKeys "%(s)", True 'Send Message
End Sub

I have gone a little overkill with the sendkeys command (VB newbie).
Can any of you guru's step into my code so that it will place the
value of a text box rather than the values I have submited via
sendkeys for the email address, subjectline, and message text.

Your help is greatly appreciated.

Regards,
Jeremy

Consider DoCmd.SendObject or
Application.FollowHyperLink "mailto:adress@domain?subject=wibble&body=text "
--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #2
Mr. Bungle wrote:
I would like to send email automatically via a command button. I have
accomplished this just fine through the following code: (Outlook
should already be open for reliable results)

Private Sub Command6_Click()
ReturnValue = Shell("Outlook.EXE", 1) ' Run Outlook
SendKeys "%(F)", True
SendKeys "W", True
SendKeys "M", True 'Open New Message
SendKeys "ra*********@harbornet.com", True '<-- Email Address
SendKeys "{TAB 2}", True
SendKeys "TestSubject", True '<-- Subject Line
SendKeys "{TAB}", True
SendKeys "Test Message", True '<-- Message Text
SendKeys "%(s)", True 'Send Message
End Sub

I have gone a little overkill with the sendkeys command (VB newbie).
Can any of you guru's step into my code so that it will place the
value of a text box rather than the values I have submited via
sendkeys for the email address, subjectline, and message text.

Your help is greatly appreciated.

Regards,
Jeremy

Consider DoCmd.SendObject or
Application.FollowHyperLink "mailto:adress@domain?subject=wibble&body=text "
--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #3
Trevor Best <nospam@localhost> wrote in message news:<40***********************@auth.uk.news.easyn et.net>...
Mr. Bungle wrote:
I would like to send email automatically via a command button. I have
accomplished this just fine through the following code: (Outlook
should already be open for reliable results)

Private Sub Command6_Click()
ReturnValue = Shell("Outlook.EXE", 1) ' Run Outlook
SendKeys "%(F)", True
SendKeys "W", True
SendKeys "M", True 'Open New Message
SendKeys "ra*********@harbornet.com", True '<-- Email Address
SendKeys "{TAB 2}", True
SendKeys "TestSubject", True '<-- Subject Line
SendKeys "{TAB}", True
SendKeys "Test Message", True '<-- Message Text
SendKeys "%(s)", True 'Send Message
End Sub

I have gone a little overkill with the sendkeys command (VB newbie).
Can any of you guru's step into my code so that it will place the
value of a text box rather than the values I have submited via
sendkeys for the email address, subjectline, and message text.

Your help is greatly appreciated.

Regards,
Jeremy

Consider DoCmd.SendObject or
Application.FollowHyperLink "mailto:adress@domain?subject=wibble&body=text "


2 questions about this...

Using the Application.FollowHyperlink can you bind the email address,
subject, and body to a control on your form?

The DoCmd.SendObject command works wonders at home where I developed
it, it automatically sends email exactly how I want it. However, to my
demise,at work the function does absolutly nothing. We use an exchange
server at work (which is where I want to use this). Might this
(exchange server) have something to do with why the DoCmd.SendObject
does not work?

The Application.FollowHyperlink alternative approach works fine at my
work, the only problem as notated above is that I would like to bind
the email, subject, and body to a control on the form. Any
suggestions?

Regards,
Jeremy

Thanks,
Jeremy
Nov 12 '05 #4
Trevor Best <nospam@localhost> wrote in message news:<40***********************@auth.uk.news.easyn et.net>...
Mr. Bungle wrote:
I would like to send email automatically via a command button. I have
accomplished this just fine through the following code: (Outlook
should already be open for reliable results)

Private Sub Command6_Click()
ReturnValue = Shell("Outlook.EXE", 1) ' Run Outlook
SendKeys "%(F)", True
SendKeys "W", True
SendKeys "M", True 'Open New Message
SendKeys "ra*********@harbornet.com", True '<-- Email Address
SendKeys "{TAB 2}", True
SendKeys "TestSubject", True '<-- Subject Line
SendKeys "{TAB}", True
SendKeys "Test Message", True '<-- Message Text
SendKeys "%(s)", True 'Send Message
End Sub

I have gone a little overkill with the sendkeys command (VB newbie).
Can any of you guru's step into my code so that it will place the
value of a text box rather than the values I have submited via
sendkeys for the email address, subjectline, and message text.

Your help is greatly appreciated.

Regards,
Jeremy

Consider DoCmd.SendObject or
Application.FollowHyperLink "mailto:adress@domain?subject=wibble&body=text "


2 questions about this...

Using the Application.FollowHyperlink can you bind the email address,
subject, and body to a control on your form?

The DoCmd.SendObject command works wonders at home where I developed
it, it automatically sends email exactly how I want it. However, to my
demise,at work the function does absolutly nothing. We use an exchange
server at work (which is where I want to use this). Might this
(exchange server) have something to do with why the DoCmd.SendObject
does not work?

The Application.FollowHyperlink alternative approach works fine at my
work, the only problem as notated above is that I would like to bind
the email, subject, and body to a control on the form. Any
suggestions?

Regards,
Jeremy

Thanks,
Jeremy
Nov 12 '05 #5
sl********@hotmail.com (Mr. Bungle) wrote:
I would like to send email automatically via a command button.


See the Access Email FAQ at my website.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #6
Mr. Bungle wrote:
Trevor Best <nospam@localhost> wrote in message news:<40***********************@auth.uk.news.easyn et.net>...
Consider DoCmd.SendObject or
Application.FollowHyperLink "mailto:adress@domain?subject=wibble&body=text "

2 questions about this...

Using the Application.FollowHyperlink can you bind the email address,
subject, and body to a control on your form?

The DoCmd.SendObject command works wonders at home where I developed
it, it automatically sends email exactly how I want it. However, to my
demise,at work the function does absolutly nothing. We use an exchange
server at work (which is where I want to use this). Might this
(exchange server) have something to do with why the DoCmd.SendObject
does not work?


No, SendObject uss your mail client, it doesn't give a hoot what your
mail server software is.
The Application.FollowHyperlink alternative approach works fine at my
work, the only problem as notated above is that I would like to bind
the email, subject, and body to a control on the form. Any
suggestions?


(assumed textbox names)

Application.FollowHyperLink "mailto:" & txtAddress & "?subject=" &
txtSubject & "&body=" & txtBody

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mr. Bungle | last post by:
I would like to send email automatically via a command button. I have accomplished this just fine through the following code: (Outlook should already be open for reliable results) Private Sub...
3
by: StuartD | last post by:
I have developed an Access database and wish to e-mail a form to a central address advising of changes etc. Have the form and command button the form with a macro behind using SendObject command....
2
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are...
1
by: George | last post by:
Every time I used the Sendkeys command in my application the "Numlock" turned off and I couldn't use the keypad to hit numbers...... The old code was: Private Sub Command1_Click() SendKeys...
0
by: federico | last post by:
Hello, how can I make a program respond to another program's input request? For example, this code: Process.Start("unrar.exe", "e D:\temp\key.rar D:temp2") SendKeys.SendWait("test~") will...
0
by: pigge79 | last post by:
Hi there, I've developing an application that translates keystrokes sent from my TV card remote control to Windows XP Media Center, since the two are not compatible. I've successfully been able...
0
by: Mac via DotNetMonster.com | last post by:
Hi all, I am attempting to send keystrokes to a telnet application I have opened from my DotNet application. But am having a issue. In my VB.Net app I firstly open the telnet app using the...
1
by: Spin | last post by:
Hi, I am trying to setup a macro that emails out a spreadsheet when activated. When I activate the macro it stops to give me a decision block if I want to send out the email "Yes", "No" or...
0
by: Graycon | last post by:
I am trying to reboot several devices on my private network through telnet. I wrote a vbs that does the operation but i cannot select any other window while it is running of the input will not go...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.