Avatar of macrohappy
macrohappy
 asked on

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
Microsoft ExcelVB Script

Avatar of undefined
Last Comment
macrohappy

8/22/2022 - Mon
jppinto

Take a look at this example:

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

jppinto
jppinto

jppinto

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
MWGainesJR

Just put this before showing the userform.
Windows("MyExcel.xls").activate
 
macrohappy

ASKER
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
MWGainesJR

you mean like sheet1?
Windows("MyExcel.xls").activate
workbooks("MyExcel.xls").sheets("Sheet1").activate
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
MWGainesJR

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
macrohappy

ASKER
Works like a charm..Thanks