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: September 19, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT In response to the rising number of data breaches and the regulatory and legal impact that can occur as a result of these incidents, leading analysts at Forrester Research have developed five important design principles that will help security professionals reduce their attack surface and mitigate vulnerabilities. Check out this upcoming eSeminar and join Chris Sherman of Forrester Research to learn how to deal with the influx of new device …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds