Secondary clipboard

This is three very simple macros, which implement a secondary clipboard. While not everyone would use it, I have found to be quite useful.

Example: I use Ctrl+C, Ctrl+V and Ctrl+X for the Windows clipboard, and map these macros in as Ctrl+Shift+C, Ctrl+Shift+V and Ctrl+Shift+X.


' Three simple macros to implement a secondary clipboard

' Global to act as clipboard
Dim g_lpszSecondClipBoard
g_lpszSecondClipBoard = ""
 
Sub SecondaryClipBoardCut() 
'DESCRIPTION: Performs a cut of current selection to a secondary clipboard.
 g_lpszSecondClipBoard = ActiveDocument.Selection.Text
 ActiveDocument.Selection.Text = "" 
End Sub
 
Sub SecondaryClipBoardCopy() 
'DESCRIPTION: Performs a copy of current selection to a secondary clipboard.
 g_lpszSecondClipBoard = ActiveDocument.Selection
End Sub
 
Sub SecondaryClipBoardPaste() 
'DESCRIPTION: Performs a paste of secondary clipboard to the current selection.
 ActiveDocument.Selection = g_lpszSecondClipBoard
End Sub



Comments

  • best one....

    Posted by Legacy on 07/30/2002 12:00am

    Originally posted by: Divya

    ur article is sooooo fine and very useful.....post many code like this...plz......also u can send private code(new) to the members responding u...(this is my kind plz asked to u)
    

    Reply
  • FIFO clipboard

    Posted by Legacy on 11/25/1999 12:00am

    Originally posted by: Jivko Velev

    Hi guys, 
    
    And here is the FIFO clipboard
    I attach these macros as follows:
    ClipboardCopy() - Ctrl+Ins
    ClipboardPaste() - Shift+Ins
    ClipboardCut() - Ctrl+Del
    ClipboardPasteAll() - Ctrl+Shift+Ins
    ClipboardClear() - Ctrl+Shift+Del
    Sorry about my bad Basic style :))

    Dim clipboard( 33 ) 'allows 32 entries
    first = 1
    last = 1

    Sub ClipboardCopy()
    nextLast = last + 1
    if ( nextLast > 33 ) then
    nextLast = 1
    end if
    if ( nextLast <> first ) then
    clipboard( last ) = ActiveDocument.Selection.Text
    last = nextLast
    end if
    End Sub

    Sub ClipboardCut()
    nextLast = last + 1
    if ( nextLast > 33 ) then
    nextLast = 1
    end if
    if ( nextLast <> first ) then
    clipboard( last ) = ActiveDocument.Selection.Text
    last = nextLast
    ActiveDocument.Selection.Text = ""
    end if
    End Sub

    Sub ClipboardPaste()
    if ( first <> last ) then
    ActiveDocument.Selection = clipboard( first )
    first = first + 1
    if ( first > 33 ) then
    first = 1
    end if
    end if
    End Sub

    Sub ClipboardPasteAll()
    Do While ( first <> last )
    ActiveDocument.Selection = clipboard( first )
    first = first + 1
    if ( first > 33 ) then
    first = 1
    end if
    Loop
    End Sub

    Sub ClipboardClear()
    last = 1
    first = 1
    clipboard( 1 ) = ""
    End Sub

    Reply
  • Creative one

    Posted by Legacy on 07/17/1999 12:00am

    Originally posted by: Vinay.P.Vaidya

    I like this idea. It will be nice if it can be extended hold a list of items.

    Reply
  • Really Nice One !

    Posted by Legacy on 02/22/1999 12:00am

    Originally posted by: Bhargav Pendse


    Macros are very Easy .
    Idea is very creative.
    thanx.

    Reply
  • Thanks.

    Posted by Legacy on 02/16/1999 12:00am

    Originally posted by: Hans Wedemeyer

    Moving from MultiEdit with 26 copy/paste buffers to VC with only one
    was hard.... this help a lot.

    thank you.

    regards
    Hans Wedemeyer

    Reply
  • LIFO stacked clipboard

    Posted by Legacy on 12/06/1998 12:00am

    Originally posted by: Goran Mitrovic

    I slightly improved your second clipboard idea...
    
    


    Dim clipboard(64)
    Dim cliplines
    cliplines=-1

    Sub StackClipboardCut()
    'DESCRIPTION: Performs a cut of current selection into LIFO stack
    if(cliplines<63) then
    cliplines=cliplines+1
    clipboard(cliplines)=ActiveDocument.Selection.Text
    ActiveDocument.Selection.Text=""
    end if
    End Sub

    Sub StackClipboardCopy()
    'DESCRIPTION: Performs a copy of current selection into LIFO stack
    if(cliplines<63) then
    cliplines=cliplines+1
    clipboard(cliplines)=ActiveDocument.Selection.Text
    end if
    End Sub

    Sub StackClipboardPaste()
    'DESCRIPTION: Performs a paste of top LIFO stack entry into current selection
    if(cliplines>-1) then
    ActiveDocument.Selection=clipboard(cliplines)
    cliplines=cliplines-1
    end if
    End Sub

    Reply
  • Very useful

    Posted by Legacy on 11/25/1998 12:00am

    Originally posted by: V.Sreenivasa Rao

    This macro is very useful . Thanks a lot.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: November 13, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT APIs can be a great source of competitive advantage. The practice of exposing backend services as APIs has become pervasive, however their use varies widely across companies and industries. Some companies leverage APIs to create internal, operational and development efficiencies, while others use them to drive ancillary revenue channels. Many companies successfully support both public and private programs from the same API by varying levels …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds