+ Reply to Thread
Results 1 to 4 of 4

easiest way to get window focus with sendkeys?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-09-2008
    Location
    blah
    Posts
    7

    easiest way to get window focus with sendkeys?

    Hi, Im trying to make a macro that pastes data into notepad repeatedly, the problem Im having though is switching focus from excel to notepad, then back to excel. I try using AppActivate myAPP (myAPP being notepad) but no matter how I write it, whether I use brackets or quotes or whatever, it always returns an error, unless AppActivate comes immediately after it opens notepad. Im starting to think that AppActivate doesnt truely do anything. Im not very familiar with API or more complex VB, so Im looking for something easy, even if its not stable.
    Thanks...

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,444

    Re: easiest way to get window focus with sendkeys?

    Can you not just write the required information to a file, do you have to have notepad open at all?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-09-2008
    Location
    blah
    Posts
    7

    Re: easiest way to get window focus with sendkeys?

    Oh I see what youre saying. it would be nice, but no, I dont need it open.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,444

    Re: easiest way to get window focus with sendkeys?

    you can use VBA code to create/append to an text file.

    commands such as Open, Print and Close would be used.
    There are examples on the forum, maybe search for I/O

    If not post back with details of what you currently do manually and include example files.

+ 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