+ Reply to Thread
Results 1 to 2 of 2

Close Adobe Application from Excel? Anyone?

  1. #1
    quartz
    Guest

    Close Adobe Application from Excel? Anyone?

    Does anyone know how to get a reference to Adobe and/or close the app?
    I am using Windows XP with Office 2003 and Adobe Professional 6.

    FYI, the following function starts Adobe, prints a file, and closes the
    file. Now I want to close the app:

    Public Function PDFPrintFile(argAdobeAppFullName As String,
    argPDFFileToPrintFullName As String)
    'START ADOBE APPLICATION AND PRINT A FILE
    Shell argAdobeAppFullName & " /p /h " & argPDFFileToPrintFullName
    End Function

    Even if I use a return value with Shell, and try something like:

    retVal.Quit

    I get an error. Can anyone help? Thanks in advance.


  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello

    Ivan , proposed you a solution here :

    http://www.excelforum.com//showthread.php?t=345869


    another solution below
    ( replace "myAppli.exe" with the Adobe Application name )


    Sub closeApplication()
    'test with WinXP & Excel2002

    'activate Microsoft WMI Scripting Library reference:
    'in Visual Basic Editor :
    'Tools
    'References
    'check the line "Microsoft WMI Scripting Library reference"
    ' and click on "OK"

    Dim objProcess As WbemScripting.SWbemObject
    Dim colProcessList As WbemScripting.SWbemObjectSet
    Dim objWMIService As WbemScripting.SWbemServices
    Dim strComputer As String

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'myAppli.exe'")
    For Each objProcess In colProcessList

    objProcess.Terminate

    Next
    End Sub



    Regards ,
    michel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1