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: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds