• Does anyone have code to open app from another app

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Does anyone have code to open app from another app

    Author
    Topic
    #357348

    HI ya
    Does anyone have any code which from one application can open up another application?
    From Word 97 I would like to open Adobe distiller.

    Thanks in advance Diana

    Viewing 3 reply threads
    Author
    Replies
    • #530688

      Try:

      Shell ""
    • #530725

      Application.FollowHyperlink …..
      Does a great job!

    • #530798

      Let’s not forget

      Application.Run

      and the API call ShellExecute.

      Also, if you are trying to start the Abode PDF maker, one assumes you have Acrobat installed. If my assumption is correct, then you also have PDFMaker installed. You can call the OnAction sub that the PDFMaker toolbar button uses and launch the distiller:

      Call PDFMAker.DoPrefsForm

      And while you’re at it, why not try calling the Distiller directly. I have no idea if that would work for you, but it looks like a reasonable thing to do:

      DistillFile(sInputFilename As String, sOutputFilename As String, sJobOptionsFilename As String)

      • #530955

        HI Kevin

        I have Adobe Acrobat Distiller installed but I’m not familiar with the call OnAction sub you mentioned.
        Have you used this before?
        how do I use?
        Do you have code to do this?

        Thanks in advance Diana

        • #530958

          its now resolved & thanking you all who responded
          cheers Diana

          • #531011

            Don’t keep us in suspense. Tell us how you solved it! Maybe someone out there has a similar problem. question question question smile

            • #534229

              Mike – the following code is how I resolved this particular issue from Word 97 open up another software application being Adobe acrobat distiller:
              hope this helps – Diana

              ‘call function blnIsAppRunning to check if distiller application is running
              If blnIsAppRunning(“Acrobat Distiller”) Then
              Else
              ‘else if distiller application not running then fire up application

              Dim RetVal
              RetVal = Shell(“C:Program FilesDistillrAcroDist.exe”, 6) ‘ Run Acrobat distiller
              End If

              ‘Function: blnIsAppRunning(ByVal vsAppName As String) As Boolean
              ‘Purpose: checks if application currently open & running
              ‘Inputs: pass in name of application to check
              ‘Returns: true or false in boolean status – blnIsAppRunning
              Public Function blnIsAppRunning(ByVal vsAppName As String) As Boolean
              Dim aTask As Task
              blnIsAppRunning = False

              For Each aTask In Tasks
              If aTask.Name = vsAppName Then
              blnIsAppRunning = True
              Exit Function
              End If
              Next aTask
              End Function

    • #530808

      Exactly what are you trying to do? Are you trying to save a Word doc as PDF? Distiller has a watch folder option. It will convert any postscript file to PDF that it finds in a folder.

      • #530952

        Hi Mike

        The logic of what I’m attempting to do is the following:

        Determine if Adobe Distiller applicaition is open.
        If not – then open up applicaiton (from word)
        convert word file to postscript & specify where the resulting postscript file is going to be stored.
        ie in C:TempIn
        With Acrobat Distiller convert postscript file to PDF.

        I then have to move file out of C:tempIn directory to
        C:Temp
        This poses another problem as I’m now experiencing file access & file locking
        if the file is a large file I will have to write code to pause & do a timer counter so I can have access to file to move.

        does this clear things up – cheers Diana

        • #531043

          Depends on what you mean by “clear”

          There’s a cloud over my head…

          But I’ll not pester much except to inquire about that middle postscript step. Is that necessary? Why not just launch the distiller on the Word document?

        • #533954

          I’m trying to accomplish exactly what you describe via Acrobat Distiller. Later, in another message, you stated that everything was resolved. Can you provide the VBA code you used to ensure Acrobat Distiller was running? Any additional commentary of insight or issues I need to be cognizant of is also appreciated. THANK YOU. confused

          • #534224

            Hi Jim – please find code below.
            Other factors you may want to consider:

            normally when you manually open up distiller – it will create folders ‘in’ & ‘out’ if doesnt exist.
            When opening up distiller using code automation – doesnt create folders – therefore you have to create using code.

            In our environment – the distiller folders to be stored in C:temp
            Our network housekeeping cleans out C:temp
            when user logs on/off.
            Therefore I have code to check if folders exist & then create.

            also
            I have code which obtains the users current default printer
            when converting to PDF – changes to the current pdf printer driver.
            when task completed
            resets printer to users default printer.
            hope this helps! Diana

            ‘I have code here that checks in registry if adobe distiler printer driver exists.
            If doesnt exist -then software application isnt installed.- exit code

            ‘if user logged onto citrix & PDF printer found
            ‘check if Acrobat Disitller application is open
            If blnLoggedOnCitrix = True And PDFPrinterFound = True Then

            ‘call function blnIsAppRunning – to check if distiller application is running
            If blnIsAppRunning(“Acrobat Distiller”) Then
            Else
            ‘else if distiller application not running then fire up application
            Dim RetVal
            RetVal = Shell(“C:Program FilesDistillrAcroDist.exe”, 6) ‘ Run Acrobat distiller
            EndIf
            EndIF

            ‘if user logged onto citrix server then PDF file will
            ‘need to be generated using different methods ie by Adobe Acrobat Distiller.
            If blnLoggedOnCitrix = True Then

            ‘PDF file created by application Adobe Acrobat Distiller
            ‘Distiller needs directories ‘In’ & ‘Out’ –
            ‘check if directories exist- if not create folders to store postscript files
            Dim strTempFolder As String
            ‘strTempFolder = Environ(“Temp”) + “In”
            strTempFolder = “C:TempIn”

            • #534282

              Diana,
              Thanks for the info. I will begin testing code, etc. today! Have a great Day!

    Viewing 3 reply threads
    Reply To: Does anyone have code to open app from another app

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: