Task Manager (shut down a task if active)

B

Brettjg

Is there a way to close an application called "PDFCreator" if it happens to
be still active? The problem that I have in running PDFCreator is that it
doesn't always shut down before the next instance of running, and won't
create the PDF. I'm using code from Ken Puls website, and have coded in both
of his suggestions to shut it down and waittime, but it still creates
problems. I have to open the task manager and close PDFCreator manually,
which is a pain in the neck in automated code.

What I'd like to do is get VB to see if PDFCreator is running, and if it is
then shut it down, before running it again. Can VB access the task manager?
Is there anything that could be done with the following code (from VB help)?
Regards, Brett.

Application.Interactive = False
Application.DisplayAlerts = False
channelNumber = Application.DDEInitiate( _
app:="WinWord", _
topic:="C:\WINWORD\FORMLETR.DOC")
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber
Application.DisplayAlerts = True
Application.Interactive = True
 
B

Brettjg

Hi there GS, you've been giving me quite a few tips lately eh?. Thanks for
all of that.

Now then, that page has a hell of lot of code in there, but when I clicked
on the link it went straight to

for /f "tokens=1" %%a in ('tlist ^| findstr /i %1') do echo kill %%a /f

for which I would subtitute

for /f "tokens=1" %%a in ('tlist ^| findstr /i PDFCreator') do echo kill %%a
/f

but surely that is not all I need to code? It's a task that I want to kill
(maybe a process, but right now I don't know the process name)
Regards, Brett


Gary''s Student said:
See:

http://groups.google.com/group/micr...l+process"++vba&rnum=2&hl=en#4f9fa19fc80add26
--
Gary''s Student - gsnu200835


Brettjg said:
Is there a way to close an application called "PDFCreator" if it happens to
be still active? The problem that I have in running PDFCreator is that it
doesn't always shut down before the next instance of running, and won't
create the PDF. I'm using code from Ken Puls website, and have coded in both
of his suggestions to shut it down and waittime, but it still creates
problems. I have to open the task manager and close PDFCreator manually,
which is a pain in the neck in automated code.

What I'd like to do is get VB to see if PDFCreator is running, and if it is
then shut it down, before running it again. Can VB access the task manager?
Is there anything that could be done with the following code (from VB help)?
Regards, Brett.

Application.Interactive = False
Application.DisplayAlerts = False
channelNumber = Application.DDEInitiate( _
app:="WinWord", _
topic:="C:\WINWORD\FORMLETR.DOC")
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber
Application.DisplayAlerts = True
Application.Interactive = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top