?
Solved

VBA: Switch front Application in VBA

Posted on 2006-11-05
3
Medium Priority
?
1,773 Views
Last Modified: 2013-11-18
I am trying to send some information from MS Access to another application (Cumulus) and then have that application display data related to the information.

The Cumulus Application used to be fully VB scriptable but has since a few years switched to JAVA instead. However, it does have one single Object in it's VB Dictionary: The Application object, and this one supports only ONE Function (which allows me to have it start one of its JAVA plug-ins, called EJPs and pass some data to it)

I am succesful in using the command to send the data to Cumulus, and if Cumulus is not already running, it will launch and come to the front and then execute my command (by executing my JAVA plug-in with the data that was sent from Acceess)

HOWEVER: If Cumulus is already running, it will NOT come to the front and the user will therefore not see the result.

My Question: How can I either force MS Access to the background or bring Cumulus to the foreground? Is there a general command in VBA that would allow this?



For reference, here is the simple code snippet in Access:

Private Sub Command0_Click()
Set cuApp = CreateObject("Cumulus6.Application")
reply = cuApp.CallEJP("com.modula4.testing.MainEJP", "Hi")
MsgBox reply
End Sub
0
Comment
Question by:Bohumil
[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 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 17879332
Hi Bohumil,

You could try this....

    AppActivate "Cumulus"

...which activates the named application. Or you might like to try something like this....

    Set cuApp = GetObject("Cumulus6.Application")

...which retreives a running instance of the application.

Regards,

Wayne
0
 

Author Comment

by:Bohumil
ID: 18025004
Thanks Wayne,
For some reason I did not seem to get a notification when you posted your suggestion--so please excuse the late acceptance. The AppActivate "..." command did the trick in principle. The problem is however that it wants the exact Window Title as an argument, and that is a bit of a problem since it depends on a number of things in Cumulus--but I think I'll be able to find a way to determine the title in the JAVA code and return it to VB as a first step and then call the Application a second time to bring it to the front and execute the actual command I am interested in.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

770 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