473,472 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 12167
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.