473,908 Members | 8,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outlook Express


Is there a way, from Access, to programmaticall y click the Send and
Receive button in Outlook?

Mar 2 '06 #1
26 4520
On Thu, 02 Mar 2006 17:03:36 -0600, Tom Becker
<wl************ @hotmail.com> wrote:

Get the Window Handle of that button, and send (PostMessage) it a
WM_CLICK message.
Why don't you tell us what you really want to do. Send emails perhaps?
How about DoCmd.SendObjec t?

-Tom.


Is there a way, from Access, to programmaticall y click the Send and
Receive button in Outlook?


Mar 3 '06 #2
Tom Becker wrote:
Is there a way, from Access, to programmaticall y click the Send and
Receive button in Outlook?


T.B., here is an A2K mdb code snippet from about five years ago for
plain Outlook 2K:

'Send/Receive
Set MyExplorer = objOutlook.Acti veExplorer
MyExplorer.Acti vate
MyExplorer.Wind owState = olMaximized
Set MyMenuBar = MyExplorer.Comm andBars.Item("S tandard")
Set MyMenuBarContro l = MyMenuBar.Contr ols.Item("Send/Re&ceive")
MyMenuBarContro l.Execute
Set MyMenuBar = Nothing

Some Dim's:
Dim MyExplorer As Explorer
Dim MyMenuBar As CommandBar
Dim MyMenuBarContro l As CommandBarContr ol
Dim objOutlook As Outlook.Applica tion

This needs a reference set to the Outlook Object library. I dug up
this example before I noticed the word "Express" in your subject line
but it may give you some ideas. Note that Outlook is easier to
automate than Outlook Express.

James A. Fortune
CD********@Fort uneJames.com

Mar 3 '06 #3
On Thu, 02 Mar 2006 22:06:11 -0700, Tom van Stiphout
<no************ *@cox.net> wrote:
On Thu, 02 Mar 2006 17:03:36 -0600, Tom Becker
<wl*********** *@hotmail.com> wrote:

Get the Window Handle of that button, and send (PostMessage) it a
WM_CLICK message.
Why don't you tell us what you really want to do. Send emails perhaps?
How about DoCmd.SendObjec t?

-Tom.
Can you tell me more about Window Handles of buttons and WM_CLICK?

I use DoCmd.SendObjec t but sometimes it's sits in the Outbox in
Outlook. I want to make sure it sends the email right away by clicking
Send and Receive.



Is there a way, from Access, to programmaticall y click the Send and
Receive button in Outlook?


Mar 3 '06 #4
On Fri, 03 Mar 2006 05:45:08 -0600, Tom Becker
<wl************ @hotmail.com> wrote:

Window handles etc are related to low-level Windows API programming.
Not recommended but as the very last resort.

"Sometimes it sits in the Outbox" sounds more like a configuration or
connectivity problem than a programming problem.

-Tom.

On Thu, 02 Mar 2006 22:06:11 -0700, Tom van Stiphout
<no*********** **@cox.net> wrote:
On Thu, 02 Mar 2006 17:03:36 -0600, Tom Becker
<wl********** **@hotmail.com> wrote:

Get the Window Handle of that button, and send (PostMessage) it a
WM_CLICK message.
Why don't you tell us what you really want to do. Send emails perhaps?
How about DoCmd.SendObjec t?

-Tom.


Can you tell me more about Window Handles of buttons and WM_CLICK?

I use DoCmd.SendObjec t but sometimes it's sits in the Outbox in
Outlook. I want to make sure it sends the email right away by clicking
Send and Receive.



Is there a way, from Access, to programmaticall y click the Send and
Receive button in Outlook?


Mar 3 '06 #5
On 2 Mar 2006 23:40:16 -0800, CD********@Fort uneJames.com wrote:
Tom Becker wrote:
Is there a way, from Access, to programmaticall y click the Send and
Receive button in Outlook?


T.B., here is an A2K mdb code snippet from about five years ago for
plain Outlook 2K:

'Send/Receive
Set MyExplorer = objOutlook.Acti veExplorer
MyExplorer.Act ivate
MyExplorer.Win dowState = olMaximized
Set MyMenuBar = MyExplorer.Comm andBars.Item("S tandard")
Set MyMenuBarContro l = MyMenuBar.Contr ols.Item("Send/Re&ceive")
MyMenuBarContr ol.Execute
Set MyMenuBar = Nothing

Some Dim's:
Dim MyExplorer As Explorer
Dim MyMenuBar As CommandBar
Dim MyMenuBarContro l As CommandBarContr ol
Dim objOutlook As Outlook.Applica tion

This needs a reference set to the Outlook Object library. I dug up
this example before I noticed the word "Express" in your subject line
but it may give you some ideas. Note that Outlook is easier to
automate than Outlook Express.

James A. Fortune
CD********@For tuneJames.com


Thanks! It looks like I need to change something to make it work in
Access 2002 though. It is with Outlook and not Outlook Express.

I get an error on this line:
Set MyExplorer = objOutlook.Acti veExplorer

The error says, "object variable or with block not set"

Dimming As CommandBar didn't work when when I added a reference to
Microsoft Outlook 10.0 object library, but it did work when I also
added Microsoft Office 10.0 object library.

Any ideas on what needs to be done?
Mar 3 '06 #6
On Fri, 03 Mar 2006 06:37:27 -0700, Tom van Stiphout
<no************ *@cox.net> wrote:
On Fri, 03 Mar 2006 05:45:08 -0600, Tom Becker
<wl*********** *@hotmail.com> wrote:

Window handles etc are related to low-level Windows API programming.
Not recommended but as the very last resort.

"Sometimes it sits in the Outbox" sounds more like a configuration or
connectivity problem than a programming problem.

-Tom.

On the configuration possibility I could check on the settings in
Outlook, But is there anything I can do about a connectivity problem?
This is over a LAN.
Mar 3 '06 #7
Tom Becker wrote:
On 2 Mar 2006 23:40:16 -0800, CD********@Fort uneJames.com wrote:
Tom Becker wrote:
Is there a way, from Access, to programmaticall y click the Send and
Receive button in Outlook?


T.B., here is an A2K mdb code snippet from about five years ago for
plain Outlook 2K:

'Send/Receive
Set MyExplorer = objOutlook.Acti veExplorer
MyExplorer.Act ivate
MyExplorer.Win dowState = olMaximized
Set MyMenuBar = MyExplorer.Comm andBars.Item("S tandard")
Set MyMenuBarContro l = MyMenuBar.Contr ols.Item("Send/Re&ceive")
MyMenuBarContr ol.Execute
Set MyMenuBar = Nothing

Some Dim's:
Dim MyExplorer As Explorer
Dim MyMenuBar As CommandBar
Dim MyMenuBarContro l As CommandBarContr ol
Dim objOutlook As Outlook.Applica tion

This needs a reference set to the Outlook Object library. I dug up
this example before I noticed the word "Express" in your subject line
but it may give you some ideas. Note that Outlook is easier to
automate than Outlook Express.

James A. Fortune
CD********@For tuneJames.com


Thanks! It looks like I need to change something to make it work in
Access 2002 though. It is with Outlook and not Outlook Express.

I get an error on this line:
Set MyExplorer = objOutlook.Acti veExplorer

The error says, "object variable or with block not set"

Dimming As CommandBar didn't work when when I added a reference to
Microsoft Outlook 10.0 object library, but it did work when I also
added Microsoft Office 10.0 object library.

Any ideas on what needs to be done?


I like your initiative. It needs a little more. Run a function to see
if outlook is running. If it's not running, I did:

Shell ("C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\O UTLOOK.EXE")
For I = 1 To 1700
DoEvents
Next I

before

Set objOutlook = GetObject("", "Outlook.Applic ation")

Another way is to use CreateObject for the case when outlook is not
running. Something like:

Set objOutlook = CreateObject("" , "Outlook.Applic ation")

before running the Send/Receive code.

Also, be careful to set objects back to Nothing when you're done using
them so that Access can close Outlook. That should get you close.

James A. Fortune
CD********@Fort uneJames.com

Verisign wants a perpetual unsupervised monopoly on the .COM registry:

http://www.bobparsons.com/EconomicsLesson.html

Mar 3 '06 #8
On 3 Mar 2006 15:17:34 -0800, CD********@Fort uneJames.com wrote:
I like your initiative. It needs a little more. Run a function to see
if outlook is running. If it's not running, I did:


**Based on code from Stephen Lebans

Function fIsOulookThere( ) As Integer
' Open the installed Version of MS Outlook
Dim OL As Object

On Error Resume Next
'See if Outlook is running
Err.Clear
' Is Outlook running?
Set OL = GetObject(, "Outlook.Applic ation")
' Error if not running
If Err.Number <> 0 Then
' Clear Error object
Err.Clear
'Create a new instance of Outlook
Set OL = CreateObject("O utlook.Applicat ion")
If Err.Number <> 0 Then
'not installed
fIsOulookThere = 0
Else
'installed but not running
fIsOulookThere = 2
End If
Else
'yes it is running
fIsOulookThere = 1
End If

If Not IsEmpty(OL) Then Set OL = Nothing

End Function

Wayne Gillespie
Gosford NSW Australia
Mar 4 '06 #9
On 3 Mar 2006 15:17:34 -0800, CD********@Fort uneJames.com wrote:
Tom Becker wrote:
On 2 Mar 2006 23:40:16 -0800, CD********@Fort uneJames.com wrote:
>Tom Becker wrote:
>> Is there a way, from Access, to programmaticall y click the Send and
>> Receive button in Outlook?
>
>T.B., here is an A2K mdb code snippet from about five years ago for
>plain Outlook 2K:
>
>'Send/Receive
>Set MyExplorer = objOutlook.Acti veExplorer
>MyExplorer.Act ivate
>MyExplorer.Win dowState = olMaximized
>Set MyMenuBar = MyExplorer.Comm andBars.Item("S tandard")
>Set MyMenuBarContro l = MyMenuBar.Contr ols.Item("Send/Re&ceive")
>MyMenuBarContr ol.Execute
>Set MyMenuBar = Nothing
>
>Some Dim's:
>Dim MyExplorer As Explorer
>Dim MyMenuBar As CommandBar
>Dim MyMenuBarContro l As CommandBarContr ol
>Dim objOutlook As Outlook.Applica tion
>
>This needs a reference set to the Outlook Object library. I dug up
>this example before I noticed the word "Express" in your subject line
>but it may give you some ideas. Note that Outlook is easier to
>automate than Outlook Express.
>
>James A. Fortune
>CD********@For tuneJames.com
Thanks! It looks like I need to change something to make it work in
Access 2002 though. It is with Outlook and not Outlook Express.

I get an error on this line:
Set MyExplorer = objOutlook.Acti veExplorer

The error says, "object variable or with block not set"

Dimming As CommandBar didn't work when when I added a reference to
Microsoft Outlook 10.0 object library, but it did work when I also
added Microsoft Office 10.0 object library.

Any ideas on what needs to be done?


I like your initiative. It needs a little more. Run a function to see
if outlook is running. If it's not running, I did:

Shell ("C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\O UTLOOK.EXE")
For I = 1 To 1700
DoEvents
Next I

before

Set objOutlook = GetObject("", "Outlook.Applic ation")

Another way is to use CreateObject for the case when outlook is not
running. Something like:

Set objOutlook = CreateObject("" , "Outlook.Applic ation")

before running the Send/Receive code.

Also, be careful to set objects back to Nothing when you're done using
them so that Access can close Outlook. That should get you close.


Thanks! I want to try it when I go back on monday. But do you have a
function that sees if Outlook is running?


James A. Fortune
CD********@For tuneJames.com

Verisign wants a perpetual unsupervised monopoly on the .COM registry:

http://www.bobparsons.com/EconomicsLesson.html


Mar 4 '06 #10

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

Similar topics

13
9138
by: ~ Le Naja ~ | last post by:
Hello evrybody, First, I hope you will understand my English because I come from Belgium ! :-) Here is what I want to know if you have the kindess to help me ! :-) I use the code above to mail with outlook express ... x = Shell("C:\Program Files\Outlook Express\msimn.exe /mailurl:mailto:destinationAdress@name.be?subject=Hello&Body=mytext") But I don't find the way to put te adress of the sender, because if I don't put the adress of the...
40
11948
by: ian | last post by:
Hi, I'm a newbie (oh no I can here you say.... another one...) How can I get Python to send emails using the default windows email client (eg outlook express)? I thought I could just do the following import win32com.client
5
7474
by: Randy Harris | last post by:
I'm using the CreateObject method to send email from Access. Set objOutlook = CreateObject("Outlook.Application") This, of course, launches Outlook to send the message. Anyone know if there is a way to do the same sort of thing but have it launch Outlook Express instead of Outlook?
3
2117
by: Steve | last post by:
Re: Outlook Express I'd like to get a log of the date and subject of all emails in my inbox received from sender@xyz.com and a log of the date and subject of all emails in my sentbox sent to sender@xyz.com. Is there a way for Access to link to these Outlook Express folders or import from these Outlook Express folders to get the sender, dates and subjects of the email therein where I could use a query to get what I want? Thanks for...
5
1910
by: =?Utf-8?B?UGF1bERIQw==?= | last post by:
Hi all, I have a customer that has Outlook and Outlook Express installed on thier PC's. I've written an app that sends emails and checks through the inbox etc to progress thier orders. This works really well, unfortunatley this works in Outlook (which I thought it was meant to be run in). They want this to run in Outlook Express. Does anyone know how I can make my app use thier Outlook express app and not thier other Outlook app. ...
5
9357
by: =?Utf-8?B?TWFya1NraQ==?= | last post by:
For about a month now, I have had trouble with Outlook Express. When logging in to Outlook Express, I get an error message stating that the connection to server has failed. My internet connection works (same server), but Outlook Express is unable to connect. If I restart the computer, Outlook Express will then be able to connect; so eventually I can use it but I must reboot every time. I have checked with my ISP and they say there is no...
2
1928
by: =?Utf-8?B?NWV1cm9wZWFuY3Vwcw==?= | last post by:
just picked up a new laptop and want to use my main email account on this machine + my desktop. I use outlook express on the desktop and wondered whether it was possible to view my main email account + contacts and history on both machines? I have been able to create an account using the same mail address on the laptop, but i'm getting some mails on one machine and some (others) on the other machine...totally confused ...can someone...
2
1488
by: =?Utf-8?B?UnVzcw==?= | last post by:
I've been using Outlook 2000 on my XP machine forever but lately it's stopped working (Outlook has encountered an error and needs to close - Send Report). I've since made the switch to Outlook Express. Can someone please tell me how to Locate and Import my Outlook Folders and Address Book into Outlook Express? Thank you.
2
2504
by: Vighneswar | last post by:
Hi All I am doing with a standalone application in .NET, where I have to invoke the Outlook / Outlook Express by passing account info (username, password, pop3 server, ... etc) and SQL Server client by passing the connection details. I request anyone can suggest me the approach in meeting the requirement. Thanks in advance. Regards
0
10031
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9875
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9721
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8094
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7246
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5930
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6134
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4770
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 we have to send another system
2
4336
muto222
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.