473,567 Members | 2,909 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 4478
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
9100
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")...
40
11814
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
7451
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
2091
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,...
5
1873
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...
5
9317
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...
2
1893
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...
2
1469
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
2491
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
7590
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...
0
7905
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8115
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7960
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6272
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...
0
3648
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...
0
3630
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2093
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
0
930
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.