Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2010-09-03
8
Medium Priority
?
355 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

598 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