ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing Applications (https://www.excelbanter.com/excel-programming/344973-closing-applications.html)

VBA Dabbler[_2_]

Closing Applications
 
Does anyone know how to close an application that is "not" in the MS Office
Suite?

Following is code I used to create a new instance of the object, but can't
seem to find the method to close the application:

Sub OpenOtherApplication(FilePath, FileName)
Dim MMApp As New MindManager.Application
Dim FilePathAndName As String

FilePathAndName = FilePath & "\" & FileName

MMApp.Visible = True
MMApp.Documents.Open (FilePathAndName)

Dnereb[_32_]

Closing Applications
 

Depends on the app you wan't to close.
if it supports VBA (autocad, microstation do)
you could use the getobject()
to instance the app and close it.

if it's not yuo will need api to find it's active window and handle
and close the thread (look at allapi.net for info on API)

N.B. this will require expoerience in VBA, a bit of VB and API


--
Dnereb


------------------------------------------------------------------------
Dnereb's Profile: http://www.excelforum.com/member.php...o&userid=26182
View this thread: http://www.excelforum.com/showthread...hreadid=482975


VBA Dabbler[_2_]

Closing Applications
 
Dnereb:
My application won't close with GetObject/CreateObject as you suspected.
Thanks for your suggestion to explore the API, and the pointer to your site -
I'm able to close the app now.

Regards,
VBA Dabbler

"Dnereb" wrote:


Depends on the app you wan't to close.
if it supports VBA (autocad, microstation do)
you could use the getobject()
to instance the app and close it.

if it's not yuo will need api to find it's active window and handle
and close the thread (look at allapi.net for info on API)

N.B. this will require expoerience in VBA, a bit of VB and API


--
Dnereb


------------------------------------------------------------------------
Dnereb's Profile: http://www.excelforum.com/member.php...o&userid=26182
View this thread: http://www.excelforum.com/showthread...hreadid=482975



NickHK

Closing Applications
 
VBA Dabbler,
Does Intellisense not give you a list of correct methods/properties etc of
the MMApp object ?
You can also use the Object Browser to search the object's model.

A different point is the use of the "Dim MyObj As New XX" syntax.
Although has it's uses, one effect is that whenever you refer to MyObj in
code you create an instance of XX, if it does not currently exist. You do
not need this functionality, so split this line into the Dim and Set;
i.e. Dim MyObj As XX
Set MyObj = New XX

NickHK

"VBA Dabbler" wrote in message
...
Does anyone know how to close an application that is "not" in the MS

Office
Suite?

Following is code I used to create a new instance of the object, but can't
seem to find the method to close the application:

Sub OpenOtherApplication(FilePath, FileName)
Dim MMApp As New MindManager.Application
Dim FilePathAndName As String

FilePathAndName = FilePath & "\" & FileName

MMApp.Visible = True
MMApp.Documents.Open (FilePathAndName)
.
.
.
MMApp.ActiveDocument.Close
Set MMApp = Nothing
End Sub

The above code functions, but I can't close the application - an instance
remains with a virgin document - I have to manually close it.

Any help would be most appreciated.
Regards,
VBA Dabbler




VBA Dabbler[_2_]

Closing Applications
 
NickHK,
Who is Intellisense? The MindManager app is from Mindjet Corporation. And
yes, I've browsed their object model using Object Browser. But, could not
find a close, quit, exit, etc. method for the Application object. I've also
sent a tech support request to Mindjet Corporation regarding this issue.

Thanks for the tip on the object declaration.

Regards,
VBA Dabbler

"NickHK" wrote:

VBA Dabbler,
Does Intellisense not give you a list of correct methods/properties etc of
the MMApp object ?
You can also use the Object Browser to search the object's model.

A different point is the use of the "Dim MyObj As New XX" syntax.
Although has it's uses, one effect is that whenever you refer to MyObj in
code you create an instance of XX, if it does not currently exist. You do
not need this functionality, so split this line into the Dim and Set;
i.e. Dim MyObj As XX
Set MyObj = New XX

NickHK

"VBA Dabbler" wrote in message
...
Does anyone know how to close an application that is "not" in the MS

Office
Suite?

Following is code I used to create a new instance of the object, but can't
seem to find the method to close the application:

Sub OpenOtherApplication(FilePath, FileName)
Dim MMApp As New MindManager.Application
Dim FilePathAndName As String

FilePathAndName = FilePath & "\" & FileName

MMApp.Visible = True
MMApp.Documents.Open (FilePathAndName)
.
.
.
MMApp.ActiveDocument.Close
Set MMApp = Nothing
End Sub

The above code functions, but I can't close the application - an instance
remains with a virgin document - I have to manually close it.

Any help would be most appreciated.
Regards,
VBA Dabbler






All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com