?
Solved

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

Posted on 2010-09-03
8
Medium Priority
?
351 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:macrohappy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 33599246
Take a look at this example:

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

jppinto
0
 
LVL 33

Expert Comment

by:jppinto
ID: 33599264
0
 
LVL 33

Expert Comment

by:jppinto
ID: 33599275
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:MWGainesJR
ID: 33599603
Just put this before showing the userform.
Windows("MyExcel.xls").activate
 
0
 

Author Comment

by:macrohappy
ID: 33599633
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
 
LVL 13

Expert Comment

by:MWGainesJR
ID: 33599673
you mean like sheet1?
Windows("MyExcel.xls").activate
workbooks("MyExcel.xls").sheets("Sheet1").activate
0
 
LVL 13

Accepted Solution

by:
MWGainesJR earned 2000 total points
ID: 33599721
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
 

Author Closing Comment

by:macrohappy
ID: 33599758
Works like a charm..Thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question