[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

How to make Excel the active application

Stefan Mueller

12/18/2006 12:34:00 PM

I start a VBA macro in Excel. This macro is running several minutes.
During that time I open e.g. the Internet Explorer.
When the VBA macro has finished it shows a MsgBox. Unfortunately I
don't see this message box because Excel is not the avtive application
at that time (the message box is behind the Internet Explorer).

How can I make Excel the active application just after the VBA macro
has finished so that I see the message box?
Stefan

4 Answers

Susan

12/18/2006 12:54:00 PM

0

i ran into this problem recently while trying to make excel play a midi
file - the windows media player would open & take the focus, and then
not allow a msgbox to show.
after much searching & reading previous postings in the newsgroup, it
is my understanding that you can't force windows to put the focus on an
inactive application........ it's not an excel issue, it's a windows
issue.
susan


Stefan Mueller wrote:
> I start a VBA macro in Excel. This macro is running several minutes.
> During that time I open e.g. the Internet Explorer.
> When the VBA macro has finished it shows a MsgBox. Unfortunately I
> don't see this message box because Excel is not the avtive application
> at that time (the message box is behind the Internet Explorer).
>
> How can I make Excel the active application just after the VBA macro
> has finished so that I see the message box?
> Stefan

Susan

12/18/2006 12:58:00 PM

0

see this thread............
http://groups.google.com/group/microsoft.public.excel.programming/browse_thread/thread/3968e6edecbcc201/d1cb7327b3b0c81a?lnk=gst&q=return+focus+to+excel&rnum=6&hl=en#d1cb73...


Stefan Mueller wrote:
> I start a VBA macro in Excel. This macro is running several minutes.
> During that time I open e.g. the Internet Explorer.
> When the VBA macro has finished it shows a MsgBox. Unfortunately I
> don't see this message box because Excel is not the avtive application
> at that time (the message box is behind the Internet Explorer).
>
> How can I make Excel the active application just after the VBA macro
> has finished so that I see the message box?
> Stefan

Susan

12/18/2006 1:00:00 PM

0

this one contains a possible solution...........
http://groups.google.com/group/microsoft.public.excel.programming/browse_thread/thread/db3035b69350a811/1d29254bd9cd75dd?lnk=gst&q=return+focus+to+excel&rnum=10&hl=en#1d2925...


Stefan Mueller wrote:
> I start a VBA macro in Excel. This macro is running several minutes.
> During that time I open e.g. the Internet Explorer.
> When the VBA macro has finished it shows a MsgBox. Unfortunately I
> don't see this message box because Excel is not the avtive application
> at that time (the message box is behind the Internet Explorer).
>
> How can I make Excel the active application just after the VBA macro
> has finished so that I see the message box?
> Stefan

Jim Cone

12/18/2006 1:15:00 PM

0

Give this a try...

Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" _
(ByVal hwnd As Long, ByVal lpText As String, _
ByVal lpCaption As String, ByVal wType As Long) As Long

Sub DoItInFront()
Dim MsgResponse As Long
MsgResponse = MessageBox(hwnd:=0, lpText:="This is a Test", _
lpCaption:="Bring to Front", wType:=vbOKCancel + vbExclamation)
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primiti...



"Stefan Mueller" <seekware@yahoo.com>
wrote in message
I start a VBA macro in Excel. This macro is running several minutes.
During that time I open e.g. the Internet Explorer.
When the VBA macro has finished it shows a MsgBox. Unfortunately I
don't see this message box because Excel is not the avtive application
at that time (the message box is behind the Internet Explorer).

How can I make Excel the active application just after the VBA macro
has finished so that I see the message box?
Stefan