+ Reply to Thread
Results 1 to 3 of 3

Clipboard

  1. #1
    Registered User
    Join Date
    02-14-2006
    Posts
    4

    Clipboard

    i have a macro that opens numerous excel spreadsheets in an array and pastes data into sheets in a master document. after each paste the source spreadsheet is closed, then the loop begins again by opening the next spreadsheet in the array.

    the problem i have is the message stating that "there is a large amount of data still on the clipboard etc.." when each source spreadsheet is closed. This requires me to manually select "NO" at the end of every loop, to inform Excel that i do not need this data to be stored for future use (as i have already pasted it).

    is there a way of disabling this, or coding something in the macro to automatically select "NO" when prompted by the clipboard message.

    any ideas welcomed!

  2. #2
    kikde
    Guest

    RE: Clipboard

    Hi,
    take this:

    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
    lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As
    Long
    Private Declare Function EmptyClipboard Lib "user32" () As Long
    Private Declare Function CloseClipboard Lib "user32" () As Long

    Public Sub CleanClipBoard()
    OpenClipboard FindWindow("xlMain", vbNullString)
    EmptyClipboard
    CloseClipboard
    end sub

    Jens



    "presuming ed" wrote:

    >
    > i have a macro that opens numerous excel spreadsheets in an array and
    > pastes data into sheets in a master document. after each paste the
    > source spreadsheet is closed, then the loop begins again by opening the
    > next spreadsheet in the array.
    >
    > the problem i have is the message stating that "there is a large amount
    > of data still on the clipboard etc.." when each source spreadsheet is
    > closed. This requires me to manually select "NO" at the end of every
    > loop, to inform Excel that i do not need this data to be stored for
    > future use (as i have already pasted it).
    >
    > is there a way of disabling this, or coding something in the macro to
    > automatically select "NO" when prompted by the clipboard message.
    >
    > any ideas welcomed!
    >
    >
    > --
    > presuming ed
    > ------------------------------------------------------------------------
    > presuming ed's Profile: http://www.excelforum.com/member.php...o&userid=31526
    > View this thread: http://www.excelforum.com/showthread...hreadid=512190
    >
    >


  3. #3
    keepITcool
    Guest

    Re: Clipboard

    Kikde,
    why use api's when excel can do it itself?

    application.cutcopymode = false will clear the clipboard.

    note to OP:

    you can avoid leaving data on the clipboard by specifying the
    destination as an argument to the copy or cut function like

    range("source").cut range("destination")


    else after every paste or when routine finishes
    or before you close the (copied) workbook use

    application.cutcopymode = false



    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    kikde wrote :

    > Hi,
    > take this:
    >
    > Private Declare Function FindWindow Lib "user32" Alias "FindWindowA"
    > (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    > Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As
    > Long) As Long
    > Private Declare Function EmptyClipboard Lib "user32" () As Long
    > Private Declare Function CloseClipboard Lib "user32" () As Long
    >
    > Public Sub CleanClipBoard()
    > OpenClipboard FindWindow("xlMain", vbNullString)
    > EmptyClipboard
    > CloseClipboard
    > end sub
    >
    > Jens
    >
    >
    >
    > "presuming ed" wrote:
    >
    > >
    > > i have a macro that opens numerous excel spreadsheets in an array
    > > and pastes data into sheets in a master document. after each paste
    > > the source spreadsheet is closed, then the loop begins again by
    > > opening the next spreadsheet in the array.
    > >
    > > the problem i have is the message stating that "there is a large
    > > amount of data still on the clipboard etc.." when each source
    > > spreadsheet is closed. This requires me to manually select "NO" at
    > > the end of every loop, to inform Excel that i do not need this data
    > > to be stored for future use (as i have already pasted it).
    > >
    > > is there a way of disabling this, or coding something in the macro
    > > to automatically select "NO" when prompted by the clipboard message.
    > >
    > > any ideas welcomed!
    > >
    > >
    > > --
    > > presuming ed
    > > --------------------------------------------------------------------
    > > ---- presuming ed's Profile:
    > > http://www.excelforum.com/member.php...o&userid=31526
    > > View this thread:
    > > http://www.excelforum.com/showthread...hreadid=512190
    > >
    > >


+ 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