How to close a program that u have opened? :~~.

How to close a program that u have opened? :~~.

Anonymous
Not applicable
465 Views
3 Replies
Message 1 of 4

How to close a program that u have opened? :~~.

Anonymous
Not applicable

Hello everybody,

 

i have a code that open PDFCreator,

 

but i have to close it, and i dunno how can i do that.

 

i use to open: Shell ("C:\Program Files\PDFCreator\PDFCreator.exe")

 

any idea guys?

 

Thanks for any. 😃

0 Likes
466 Views
3 Replies
Replies (3)
Message 2 of 4

arcticad
Advisor
Advisor

Public Sub killTask()
killString = "taskkill /F /IM PDFCreator.exe"
Call Shell(killString, vbHide)
End Sub

---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 3 of 4

Mike.Wohletz
Collaborator
Collaborator
       Dim processID As Integer = Shell("C:\Program Files\PDFCreator\PDFCreator.exe")

        ' do something with the process here

      
        'end the process
        Try
            Dim process As Process = System.Diagnostics.Process.GetProcessById(processID)
            process.Kill()
            process.Dispose()
        Catch ex As Exception

        End Try

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

I didi something ugly,

 

but it worked,

 

i've created a.bat file with tskill, and i run the tskill from vba =P

 

is a long way, but i dont need procession speed, so it worked fine.

0 Likes