Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I stop an application in VB ?

Status
Not open for further replies.

Hanss

Technical User
Feb 15, 2001
85
CH
I am having trouble closing an application (scan.exe) which I am running from access in VB. Here is what I tried:

application.quit (this closed access!)
scan.application.quit (error message)

Any help would be greatly appreciated.

Hanss
Zurich

Here is my code:


Public Function test(strfile1 As String)
Shell "C:\program files\scan\scan.exe"
Dim App As Object
Set App = CreateObject("Scan.Application")
Dim Worksheet As Object
Dim hw1b2 As Object
Set hw1b2 = App.OpenImage(strfile1)
Dim Left0(1) As Long
Left0(0) = 34
Dim Right1(1) As Long
Right1(0) = 255
ResultCode = hw1b2.testObjects(1)
Set Worksheet = App.GetWorksheet
'Worksheet.MakePermanent
ResultCode = Worksheet.SaveAs("C:\temp.xls")


??? I would like to know what I have to put here to make scan.exe close.

End Function
 
Hi


Set App = CreateObject("Scan.Application")

won't this open another instance of Scan.exe?

should it be


Set App = GetObject("Scan.Application")

have you tries

App.stop


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Many thanks for your reply! Here is what happened when I tried these suggestions:

Set App = GetObject("Scan.Application")

I got this error message: "Runtime error"
Set App = CreateObject("Scan.Application") works fine. All I want to do is close the application.

App.stop

I got this error: Object doesn't support this property or method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top