Opening other applications from VBA (difficult one)

philR

Active Member
Joined
Feb 25, 2002
Messages
257
OK, I know how to open other applications using (for example):

Set myApp = CreateObject("Outlook.Application")

However, I am trying to get VB to talk to an application called ReflectionX (it is a piece of software enabling users to log onto UNIX systems from PC, not that that should matter). I have looked in explorer and the application is called Rx.exe but when I try the line:

Set myReflection = CreateObject("Rx.application")

.. it says "ActiveX component can't create object" which usually tells me I have the application name wrong. But I don't think I have. Does anyone know what is going wrong here?

Thanks for any help

Phil
This message was edited by philR on 2002-10-17 06:18
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
That won't work unless ReflectionX is OLE compliant. Try:

X = Shell("Rx.exe",1)

You may need the full path. The 1 specifies a normal size window, with the focus. X will contain the task identification number for the application.
 
Upvote 0
Hi Phil,

What is it that you are trying to do with the other piece of software? Does it have to be referenced in the way described?

I am not familiar with ReflectionX, but would it be possible to use "Shell" instead. I know that this works if you want to use, for example, WinZip from within Excel.

HTH
 
Upvote 0
Hi Phil.
I use Reflection for Regis graphics. Very nice program.
This example may vary depending on your version...
Reflection products only have one Object, namely the "Session" object.
Chances are, if you want the full functionality of ReflectionX, you do not want to use the ActiveX Control(ocx). Instead set a reference to the reflection Library(olb). While in the VBAIDE, choose "Tools", "References", find your reflection product listed. Then use your code to reference the "Session" object ad all of it's Methods, Properties, ect...
This is an automated logon procedure I use from an Excel workbook:<pre>
Sub HiddenSession_WORKSCHED()
Dim DefaultMenu As String, StatusBarMessage As String
UserName = "jbh018"
PassW = "eric83"
TryItAgain:
Dim CR As String


Sheet1.Range("E3").Value = "Creating Reflection_4 Session - Please Wait"

CR = Chr$(13)

Set MySession = CreateObject("Reflection4.Session")

With MySession

.ConnectionType = "BEST-NETWORK"

.ConnectionSettings = "Host 155.118.208.138"

.ConnectionSettings = "DefaultNetwork TELNET"

.Connect

.Wait "2"

.Transmit UserName & CR

.Wait "2"

Sheet1.Range("E3").Value = "Logging In - Please Wait"

.Transmit PassW, rcDecodePassword

.Transmit CR

.CommitLoginProperties

.Wait "20"

DefaultMenu = Trim(.GetText(1, 30, 1, 50))

If DefaultMenu<> "DROP LOT MANAGER" Then
.Quit
GoTo TryItAgain
End If
.Visible = True
.Transmit "1": .Wait "2"
.Transmit "4": .Wait "2"
.Transmit CR: .Wait "2"
.Transmit CR: .Wait "2"
.Transmit CR: .Wait "5"
.Visible = False

End With 'MySession
Sheet1.Range("E3").Value = "Looking For TRLDISPLY"
End Sub</pre>
Tom

I was looking at some of the other replies using "Shell". I think the shell command is not what you are after. That will simply start the application in a separate process and independant of your control. Using the procedure above, you are running it in the same process space as Excel, as a dll, and retain complete control over the application.

Just another note:
This syntax will work just as well. This is how I create my session currently.
Set MySession = New Reflection4.Session
This message was edited by TsTom on 2002-10-17 06:51
 
Upvote 0
On 2002-10-17 06:18, philR wrote:
OK, I know how to open other applications using (for example):

Set myApp = CreateObject("Outlook.Application")

However, I am trying to get VB to talk to an application called ReflectionX (it is a piece of software enabling users to log onto UNIX systems from PC, not that that should matter). I have looked in explorer and the application is called Rx.exe but when I try the line:

Set myReflection = CreateObject("Rx.application")

.. it says "ActiveX component can't create object" which usually tells me I have the application name wrong. But I don't think I have. Does anyone know what is going wrong here?

Thanks for any help

Phil
This message was edited by philR on 2002-10-17 06:18

To use createobject you need the applications
Class name and NOT the application name.
Easiest method is to do what the others have suggested = Use Shell command.
There are other methods which can afford you more control over the application.
 
Upvote 0
Wow, that was fast guys! Didn't expect to get any answers to that one.

Andrew, that works - thanks loads.

bolo and Richie, thanks to you too, very quick off the mark I must say.

TsTom - Yours looks like exactly the sort of thing I need. Thanks very much. It will take me a while to work through your solution, but I am sure it will work - I have read a lot of your threads and they are always Genius.

Ivan - just got yours, thank you as well. Might be asking you about those other methods when I have worked my way through this lot!


Thanks again all

Phil
This message was edited by philR on 2002-10-17 06:39
 
Upvote 0
Go with Toms
He has given you the class name and the references you need in your project. So now that it's properties are exposed you can use
its controls to do what you want.
 
Upvote 0
Great answers! Related question: Would it be possible to Shell and control a terminal emulator process in order to create processes in other operating systems?? I'm assuming I can't directly 'Shell' a program on a networked UNIX box.
 
Upvote 0
On 2003-01-30 22:06, DaveB wrote:
Great answers! Related question: Would it be possible to Shell and control a terminal emulator process in order to create processes in other operating systems?? I'm assuming I can't directly 'Shell' a program on a networked UNIX box.

Yes you can Shell out to any program.
If it is COM complient then you can control it...if NOT then then only thing you can do is close it down.
To control a Non complient COM application you may have to use Sendkeys OR have a look at the applications Script language ??
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,759
Members
449,048
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top