+ Reply to Thread
Results 1 to 6 of 6

Retrieving Cut/Copy Border Address

  1. #1
    Joseph Mc Daid
    Guest

    Retrieving Cut/Copy Border Address

    I am looking for a way to retrieve the address of the cut/copy border
    in excel, but have had absolutely no joy browsing the forums and
    excel's object model. If I've missed something obvious I apologise,
    but any help would be appreciated at this stage.

    Kind Regards,

    Jose


  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    HelloJose,

    To return the address of the cut/copy border, use Selection.Address.

    Sincerely,
    Leith Ross

  3. #3
    Joseph Mc Daid
    Guest

    Re: Retrieving Cut/Copy Border Address

    Dear Leith,

    Selection.Address returns the current selection's address, which may
    have changed since the user chose to copy the range. If my macro was
    run directly after the user selected the copy range this may work,
    however this is almost never going to be the case.

    What i am ideally after is the address of the "moving border" copy box
    that appears on screen when the user chooses to copy a range.

    Regards,

    Joseph Mc Daid


  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Joseph,

    After looking deeper into what you want to do, I can say there are no easy methods to accomplish it. The easiest would be to monitor the cells being selected using the Worksheet_Change() event. The drawback being this has to be copied into every worksheet in the workbook that will be using this. The second and by far the most unattractive and complex would be to retrieve the cell addresses copied to the Clipboard. Once the user selects a different cell, the contents to be cut or copied are transfered to the clipboard, and Excel no longer has those addresses stored internally. Sorry the news isn't better.

    Siincerely,
    Leith Ross

  5. #5
    Joseph Mc Daid
    Guest

    Re: Retrieving Cut/Copy Border Address

    Dear Leith,

    I am not averse to following the complex route, if there is come means
    of accessing the source cell addresses by delving into the clipboard
    contents then i shall investigate.

    Off the top of my head i wouldn't think that the source address would
    be stored in the clipboard, but i have no prior experience, so thats
    just conjecture. Can you confirm that the source range is stored in the
    clipboard? Any thoughts on API calls that you might know off the top of
    your head that could be used to access the clipboard would be
    appreciated. I suspect this is headache material so i apologise in
    advance :-)

    Kind Regards,

    Joseph Mc Daid


  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Joseph,

    I will look into the Clipboard API calls more, as my experience with them is limited. You may be correct about the addresses not be stored. The API calls only deal with "formats". So the addresses may be a moot point. I don't think hooking into the Windows messaging system via Subclassing would be a very viable option to "spy" on the CTRL + C or CTRL + X keys input. It is an interesting problem. I will let you know what I find.

    Sincerely,
    Leith Ross

+ 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