+ Reply to Thread
Results 1 to 4 of 4

How to reference win.caption, when caption changes

  1. #1
    Forum Contributor
    Join Date
    07-01-2005
    Posts
    103

    How to reference win.caption, when caption changes

    I have a macro that looks for a window name with win.Caption = "..."
    The problem I'm facing is that the window caption changes slightly every day. Is there a way to only reference the last x characters of the caption, or allow wildcards in the middle? Thanks

  2. #2
    Tom Ogilvy
    Guest

    RE: How to reference win.caption, when caption changes

    without having seen your code, I would refer you to VBA help on LIKE and INSTR

    --
    Regards,
    Tom Ogilvy


    "Paul987" wrote:

    >
    > I have a macro that looks for a window name with win.Caption = "..."
    > The problem I'm facing is that the window caption changes slightly
    > every day. Is there a way to only reference the last x characters of
    > the caption, or allow wildcards in the middle? Thanks
    >
    >
    > --
    > Paul987
    > ------------------------------------------------------------------------
    > Paul987's Profile: http://www.excelforum.com/member.php...o&userid=24850
    > View this thread: http://www.excelforum.com/showthread...hreadid=530901
    >
    >


  3. #3
    Martin
    Guest

    RE: How to reference win.caption, when caption changes

    You could use Right, Left or Mid functions to grab bits. Perhaps more
    flexibly, use InStr, e.g.

    If InStr(win.Caption, "xxx") <> 0 Then ...

    "Paul987" wrote:

    >
    > I have a macro that looks for a window name with win.Caption = "..."
    > The problem I'm facing is that the window caption changes slightly
    > every day. Is there a way to only reference the last x characters of
    > the caption, or allow wildcards in the middle? Thanks
    >
    >
    > --
    > Paul987
    > ------------------------------------------------------------------------
    > Paul987's Profile: http://www.excelforum.com/member.php...o&userid=24850
    > View this thread: http://www.excelforum.com/showthread...hreadid=530901
    >
    >


  4. #4
    Forum Contributor
    Join Date
    07-01-2005
    Posts
    103
    thanks guys. Martin - I used your advice, it worked well.
    I'm don't know how to write VBA, but I seem to be able to piece things together, like in this instance. Thanks

+ 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