469,366 Members | 2,254 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

What is up with the Shell command here?

Hi folks,

In an A2K app, I have attempted to use the following command in some
VBA code with IDENTICAL results with every single version of the
following:

Shell "outlook.exe", vbHide
Shell "outlook.exe", vbNormalFocus
Shell "outlook.exe", vbMinimizedFocus
Shell "outlook.exe", vbMaximizedFocus
Shell "outlook.exe", vbNormalNoFocus
Shell "outlook.exe", vbMinimizedNoFocus

In every instance above, Outlook loads and shows me the Outlook window
and just stays there! All I want to do is to load Outlook in the
background and stay focused on the form that I was on when the command
was issued.

IOW -- the command arguments simply do not work as documented. Anyone
have a clue what I'm overlooking?

Thanks in advance.

-- LW
Nov 13 '05 #1
6 9574
On Sat, 19 Mar 2005 18:52:05 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:

Apparently Outlook is trying to be too helpful, thinking it knows
best.
Perhaps you can use the BringWindowToTop API to set focus back to
where you want it.

-Tom.

Hi folks,

In an A2K app, I have attempted to use the following command in some
VBA code with IDENTICAL results with every single version of the
following:

Shell "outlook.exe", vbHide
Shell "outlook.exe", vbNormalFocus
Shell "outlook.exe", vbMinimizedFocus
Shell "outlook.exe", vbMaximizedFocus
Shell "outlook.exe", vbNormalNoFocus
Shell "outlook.exe", vbMinimizedNoFocus

In every instance above, Outlook loads and shows me the Outlook window
and just stays there! All I want to do is to load Outlook in the
background and stay focused on the form that I was on when the command
was issued.

IOW -- the command arguments simply do not work as documented. Anyone
have a clue what I'm overlooking?

Thanks in advance.

-- LW


Nov 13 '05 #2
On Sat, 19 Mar 2005 18:17:41 -0700, Tom van Stiphout
<no*************@cox.net> wrote:

Please forgive my ignorance -- BringWindowToTop API?
Where is that?

On Sat, 19 Mar 2005 18:52:05 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:

Apparently Outlook is trying to be too helpful, thinking it knows
best.
Perhaps you can use the BringWindowToTop API to set focus back to
where you want it.

-Tom.

Hi folks,

In an A2K app, I have attempted to use the following command in some
VBA code with IDENTICAL results with every single version of the
following:

Shell "outlook.exe", vbHide
Shell "outlook.exe", vbNormalFocus
Shell "outlook.exe", vbMinimizedFocus
Shell "outlook.exe", vbMaximizedFocus
Shell "outlook.exe", vbNormalNoFocus
Shell "outlook.exe", vbMinimizedNoFocus

In every instance above, Outlook loads and shows me the Outlook window
and just stays there! All I want to do is to load Outlook in the
background and stay focused on the form that I was on when the command
was issued.

IOW -- the command arguments simply do not work as documented. Anyone
have a clue what I'm overlooking?

Thanks in advance.

-- LW


Nov 13 '05 #3
On Sat, 19 Mar 2005 21:25:11 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:
It's a Windows API call.

Put this in a module:
Public Declare Function BringWindowToTop Lib "user32" Alias
"BringWindowToTop" (ByVal hwnd As Long) As Long

Then call it using code like:
Shell "outlook.exe", vbNormalNoFocus 'no focus does not work.
BringWindowToTop Application.hWndAccessApp 'bring my Access app back
to the foreground

-Tom.

On Sat, 19 Mar 2005 18:17:41 -0700, Tom van Stiphout
<no*************@cox.net> wrote:

Please forgive my ignorance -- BringWindowToTop API?
Where is that?

On Sat, 19 Mar 2005 18:52:05 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:

Apparently Outlook is trying to be too helpful, thinking it knows
best.
Perhaps you can use the BringWindowToTop API to set focus back to
where you want it.

-Tom.

Hi folks,

In an A2K app, I have attempted to use the following command in some
VBA code with IDENTICAL results with every single version of the
following:

Shell "outlook.exe", vbHide
Shell "outlook.exe", vbNormalFocus
Shell "outlook.exe", vbMinimizedFocus
Shell "outlook.exe", vbMaximizedFocus
Shell "outlook.exe", vbNormalNoFocus
Shell "outlook.exe", vbMinimizedNoFocus

In every instance above, Outlook loads and shows me the Outlook window
and just stays there! All I want to do is to load Outlook in the
background and stay focused on the form that I was on when the command
was issued.

IOW -- the command arguments simply do not work as documented. Anyone
have a clue what I'm overlooking?

Thanks in advance.

-- LW


Nov 13 '05 #4
On Sat, 19 Mar 2005 20:53:10 -0700, Tom van Stiphout
<no*************@cox.net> wrote:

Thanks a LOT Tom.

Well, I tried this. The code executes just fine but it makes no
difference whatsoever -- Outlook doesn't even flicker -- it just stays
on top. Go figure.

Anyone else have a clue why this is happening?
On Sat, 19 Mar 2005 21:25:11 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:
It's a Windows API call.

Put this in a module:
Public Declare Function BringWindowToTop Lib "user32" Alias
"BringWindowToTop" (ByVal hwnd As Long) As Long

Then call it using code like:
Shell "outlook.exe", vbNormalNoFocus 'no focus does not work.
BringWindowToTop Application.hWndAccessApp 'bring my Access app back
to the foreground

-Tom.

On Sat, 19 Mar 2005 18:17:41 -0700, Tom van Stiphout
<no*************@cox.net> wrote:

Please forgive my ignorance -- BringWindowToTop API?
Where is that?

On Sat, 19 Mar 2005 18:52:05 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:

Apparently Outlook is trying to be too helpful, thinking it knows
best.
Perhaps you can use the BringWindowToTop API to set focus back to
where you want it.

-Tom.
Hi folks,

In an A2K app, I have attempted to use the following command in some
VBA code with IDENTICAL results with every single version of the
following:

Shell "outlook.exe", vbHide
Shell "outlook.exe", vbNormalFocus
Shell "outlook.exe", vbMinimizedFocus
Shell "outlook.exe", vbMaximizedFocus
Shell "outlook.exe", vbNormalNoFocus
Shell "outlook.exe", vbMinimizedNoFocus

In every instance above, Outlook loads and shows me the Outlook window
and just stays there! All I want to do is to load Outlook in the
background and stay focused on the form that I was on when the command
was issued.

IOW -- the command arguments simply do not work as documented. Anyone
have a clue what I'm overlooking?

Thanks in advance.

-- LW


Nov 13 '05 #5
On Sat, 19 Mar 2005 23:15:17 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:

Probably because Shell is an asynchronous call. It's a "shoot and
forget" kind of function call. Outlook will materialize many
milliseconds after the call is made, and well after the next call to
BringWindowToTop is executed.

Try this:
Shell "outlook.exe", vbNormalNoFocus
Me.TimerInterval = 500

Private Sub Form_Timer()
Me.TimerInterval=0 'stop timer
BringWindowToTop Application.hWndAccessApp
End Sub

-Tom.
On Sat, 19 Mar 2005 20:53:10 -0700, Tom van Stiphout
<no*************@cox.net> wrote:

Thanks a LOT Tom.

Well, I tried this. The code executes just fine but it makes no
difference whatsoever -- Outlook doesn't even flicker -- it just stays
on top. Go figure.

Anyone else have a clue why this is happening?
On Sat, 19 Mar 2005 21:25:11 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:
It's a Windows API call.

Put this in a module:
Public Declare Function BringWindowToTop Lib "user32" Alias
"BringWindowToTop" (ByVal hwnd As Long) As Long

Then call it using code like:
Shell "outlook.exe", vbNormalNoFocus 'no focus does not work.
BringWindowToTop Application.hWndAccessApp 'bring my Access app back
to the foreground

-Tom.

On Sat, 19 Mar 2005 18:17:41 -0700, Tom van Stiphout
<no*************@cox.net> wrote:

Please forgive my ignorance -- BringWindowToTop API?
Where is that?
On Sat, 19 Mar 2005 18:52:05 -0600, Lauren Wilson <pr*****@nospam.com>
wrote:

Apparently Outlook is trying to be too helpful, thinking it knows
best.
Perhaps you can use the BringWindowToTop API to set focus back to
where you want it.

-Tom.
>Hi folks,
>
>In an A2K app, I have attempted to use the following command in some
>VBA code with IDENTICAL results with every single version of the
>following:
>
>Shell "outlook.exe", vbHide
>Shell "outlook.exe", vbNormalFocus
>Shell "outlook.exe", vbMinimizedFocus
>Shell "outlook.exe", vbMaximizedFocus
>Shell "outlook.exe", vbNormalNoFocus
>Shell "outlook.exe", vbMinimizedNoFocus
>
>In every instance above, Outlook loads and shows me the Outlook window
>and just stays there! All I want to do is to load Outlook in the
>background and stay focused on the form that I was on when the command
>was issued.
>
>IOW -- the command arguments simply do not work as documented. Anyone
>have a clue what I'm overlooking?
>
>Thanks in advance.
>
>-- LW


Nov 13 '05 #6
Lauren Wilson <pr*****@nospam.com> wrote in
news:rs********************************@4ax.com:

I think that to open Outlook minimized one must not have the Open Outlook Today
option selected.

Outlook Today -> Customize Outlook Today

--
Lyle
--
Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

54 posts views Thread by Brandon J. Van Every | last post: by
4 posts views Thread by Yann.K | last post: by
8 posts views Thread by Siemel Naran | last post: by
3 posts views Thread by Mr Utkal Ranjan | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.