Making excel always active so a Userform when triggered always appears on top

I have a excel VBA macro that runs on a machine along with several applications. The macro is continuously scanning Atttachamate Extra session for certain conditions and if the condiditions are met the Userform pops up for 30 seconds. The problem I have is that is the excel spreadsheet is not visible on the actual screen the Userform gets hidden when it pops up. Is there any way to ensure that either the excel sheet is always on top of the other applications (i.e activate command at the end of the code) or program the Userform to always be on top of all active applications? This is how I call the userform now  

ALERTForm.Show vbModal
macrohappyAsked:
Who is Participating?
 
MWGainesJRConnect With a Mentor Commented:
If you run:
Windows("MyExcel.xls").activate
from VBA Editor, Excel will not cover VBA Editor.  This is expected.   If for example you have two workbooks open "book1" and "Myexcel.xls"
If you create:
Sub activate()
Windows("MyExcel.xls").activate
end sub
in book1 and run Activate() from book1 by choosing it in the macro list (ALT+F8)......myexcel.xls will pop up.....
0
 
jppintoCommented:
Take a look at this example:

http://xcelfiles.homestead.com/API_10.html

jppinto
0
 
jppintoCommented:
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
MWGainesJRCommented:
Just put this before showing the userform.
Windows("MyExcel.xls").activate
 
0
 
macrohappyAuthor Commented:
MWGainesJR: I did just now add that to the code but the excel spreadsheet itself does not come to the front is that expected? I have not yet tested for the userform as it is a little cumbersome for  the conditions to be met to trigger the parameters
0
 
MWGainesJRCommented:
you mean like sheet1?
Windows("MyExcel.xls").activate
workbooks("MyExcel.xls").sheets("Sheet1").activate
0
 
macrohappyAuthor Commented:
Works like a charm..Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.