+ Reply to Thread
Results 1 to 15 of 15

Controlling other windows applications

  1. #1
    Registered User
    Join Date
    08-01-2007
    Location
    Johannesburg
    Posts
    8

    Controlling other windows applications

    I am new to this forum, and hope to become a regular.

    I am self taught on VBA and I have written many useful macros. Being self taught has its cons because there is still a lot that I dont know.

    I want to know how to control other windows programs using VBA from excel. I want to run the macro, have it open a program that is installed in windows. be able to move the mouse in that program and type using the data in excel. Is this possible?

    Pls can you keep the answer simple... thanks in advance.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    It is possible

    Without knowing what program you are refering I gan only give the above reply
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    08-01-2007
    Location
    Johannesburg
    Posts
    8
    It is software used internally that was developed specifically for the company I work for... so thats not going to help.

    However lets maybe use the following programs so that I could see the difference and learn this new skill. Pls use what ever scenario you would like, the below is just an example.

    Open notepad,
    write text from text in excel,
    then print and close the application.

    Open paint
    draw a line
    make a selection
    copy a selection
    paste copied selection into excel
    exit paint

  4. #4
    Registered User
    Join Date
    07-25-2007
    Posts
    24

    hmm

    mudraker you say excel can control other programs, how about internet explorer??

  5. #5
    Registered User
    Join Date
    08-01-2007
    Location
    Johannesburg
    Posts
    8
    Internet Explorer would be a great example too.

    Come on guys... someone must know

  6. #6
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76
    PilotC !
    Are you writing a new Windows ?

  7. #7
    Registered User
    Join Date
    08-01-2007
    Location
    Johannesburg
    Posts
    8
    Negative.

    Just need to produce an input from excel to a program and have the program produce an output back to excel.

  8. #8
    Registered User
    Join Date
    05-15-2007
    Posts
    16
    I'm rather curious of this myself, since I recently completed an Excel data entry project that would have been a great help to have had a way to send commands (like the Wscript sendkeys method) from VBA instead so that I could have had Excel not only open the web page, but then fill out the form, click a button to copy the results to the clipboard, and paste the information to a new sheet in the workbook. Alas, without a method of controlling the webpage, I was only able to create a macro to simplify the data entry method while I still hand-completed the web form.

  9. #9
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Going back to one of the early request, you could use the SHELL command

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    will open an instance of notepad or paint so you can perform your actions in that application.

    Another thing you can do is use data in excel to write / extract data from an access database.

    Internet explorer gets a bit more messy. Before going down that track, does the SHELL command get you going?

    rylo

  10. #10
    Registered User
    Join Date
    08-01-2007
    Location
    Johannesburg
    Posts
    8
    Quote Originally Posted by rylo
    Hi

    Going back to one of the early request, you could use the SHELL command

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    will open an instance of notepad or paint so you can perform your actions in that application.

    Another thing you can do is use data in excel to write / extract data from an access database.

    Internet explorer gets a bit more messy. Before going down that track, does the SHELL command get you going?

    rylo
    Thanks for the positive reply... works great!

    what i need to know is how to type on a newly opened window, the program is very similar to DOS... so i would need to utitilies text or numbers in a cell in the excel file and get excel to type it into this program with a prefix. It would then open a white box and i need excel to type a standard directory e.g. c:/1/1.txt, and then click ok.. That would "print" the results to a text file in that directory.

    From there I know how to make excel import the text file and so on.

  11. #11
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    HI

    Have a look at the SENDKEYS function.

    Please Login or Register  to view this content.
    This will open notepad, and send the string fred.

    I'm not really sure from your post what will be going to the output screen / output file. Does your program take your input (say from SENDKEYS and then do something with it, resulting in an output text file?

    rylo

  12. #12
    Registered User
    Join Date
    05-15-2007
    Posts
    16
    Quote Originally Posted by rylo
    HI

    Have a look at the SENDKEYS function.

    Please Login or Register  to view this content.
    This will open notepad, and send the string fred.
    I could not find the VBA sendkeys method in the references I have available. Where do I find out more about this? Say, for example, as to determining how to send special keyboard entries like Ctrl-C for the copy to clipboard function? I'm also assuming this can be duplicated in VBscript as well?

  13. #13
    Registered User
    Join Date
    08-08-2007
    Posts
    1

    Windows Program Manipulation

    Mercury WinRunner or QuickTestPro can easily manipulate the windows environment as you requested. Not sure if that helps.

  14. #14
    Registered User
    Join Date
    07-25-2007
    Posts
    24

    Hey Rylo

    I dont believe the shell method will help me.
    I'm trying to use an extract external data from a webpage, but it requires a login/pass.

    You said that excel could control I.E.
    How?

    Any help would be most appreciated.

    -Adil

  15. #15
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Gees all - this post is starting to get out of control.

    ShannonLarson
    You should be able to find some help on Sendkeys in the VBE help area. If that doesn't work, then go to the microsoft product support site for excel, and do a search on sendkeys. You should be able to get some help there.

    http://msdn2.microsoft.com/en-us/lib...nd(VS.71).aspx

    will give you a listing of all the key codes.

    Adilhooda

    Here is some code to get you started. You don't give any details on what you want to do, but you do mention a password. There are various caveats about providing code to work with passwords given the potential for misuse, so I won't even go there. If the code below gives you some pointers, then great. There is code about on various excel sites that does give some details on how to use passwords, so I suggest you go looking. If you use some of the key words in the code below, it may help narrow down your search.

    Please Login or Register  to view this content.
    rylo

+ 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