Consulting

Results 1 to 5 of 5

Thread: taking application focus away from 3rd party software

  1. #1
    Knowledge Base Approver
    Space Cadet
    VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location

    taking application focus away from 3rd party software

    Hi all.

    I've posted this problem before in Word help and thought I'd give it one more try in this section. Is there any way to force focus from another application on Word, using VBA (the macro would be running behind the third party software)? i've tried API calls as well as ".Activate" and ".SetFocus" but none of this works the second time around. the third party swoftware only releases focus on creation of the first document.

    Any help would really be appreciated.
    thanks
    Andrew;?

    I'm working with Office 2003 ad Windows XP and the third party software that creates the word doucments is called AIM Evolution (a lawfirm back office system) with Sculptor as the front end.
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  2. #2
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Have you tried AppActivate ("Microsoft Word")?

    Regards,
    Brandtrock




  3. #3
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    Just tried it and I got an invalid procedure call/invalid argument - poop! Maybe I used it in the wrong context. do you maybe have and example you could post to show how I could integrate it?
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  4. #4
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    From Microsoft

    Example

    The following example demonstrates the use of a single .wsf file for two jobs in different script languages (VBScript and JScript). The functionality of both jobs is the same ? each runs the Windows calculator and sends it keystrokes to execute a simple calculation.

    The following example starts the Windows calculator and uses AppActivate to ensure that the calculator is at the top.

    [VBA] <package>
    <job id="vbs">
    <script language="VBScript">
    set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "calc"
    WScript.Sleep 100
    WshShell.AppActivate "Calculator"
    WScript.Sleep 100
    WshShell.SendKeys "1{+}"
    WScript.Sleep 500
    WshShell.SendKeys "2"
    WScript.Sleep 500
    WshShell.SendKeys "~"
    WScript.Sleep 500
    WshShell.SendKeys "*3"
    WScript.Sleep 500
    WshShell.SendKeys "~"
    WScript.Sleep 2500
    </script>
    </job>

    <job id="js">
    <script language="JScript">
    var WshShell = WScript.CreateObject("WScript.Shell");
    WshShell.Run("calc");
    WScript.Sleep(100);
    WshShell.AppActivate("Calculator");
    WScript.Sleep(100);
    WshShell.SendKeys("1{+}");
    WScript.Sleep(500);
    WshShell.SendKeys("2");
    WScript.Sleep(500);
    WshShell.SendKeys("~");
    WScript.Sleep(500);
    WshShell.SendKeys("*3");
    WScript.Sleep(500);
    WshShell.SendKeys("~");
    WScript.Sleep(2500);
    </script>
    </job>
    </package>
    [/VBA]

    HTH,
    Brandtrock




  5. #5
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    Okay. It makes sense. Now how would I integegrate that into a VBA macro. I'm guessing ("Scripting.FileSystemObject") or something similar but I'm not sure??
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


Posting Permissions

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