Results 1 to 6 of 6

Thread: cut,copy,paste,select all

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    16

    Exclamation cut,copy,paste,select all

    ei..der can any body help me on to make the code for copy,cut,paste, and select all?

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: cut,copy,paste,select all

    COPY CODE
    Code:
    Clipboard.Clear
    Clipboard.SetText Screen.ActiveControl.SelText
    CUT CODE
    Code:
    Clipboard.Clear
       Clipboard.SetText Screen.ActiveControl.SelText
       Screen.ActiveControl.SelText = ""
    PASTE CODE
    Code:
    Screen.ActiveControl.SelText = Clipboard.GetText()

  3. #3
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: cut,copy,paste,select all

    Code:
    Option Explicit
    
    Private Sub RichTextBox1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
        If Button = vbRightButton Then
            PopupMenu mnuRTB
        End If
    End Sub
    
    Private Sub mnuCut_Click()
        With RichTextBox1
            Clipboard.SetText .SelText
            .SelText = vbNullString
        End With
    End Sub
    
    Private Sub mnuCopy_Click()
        With RichTextBox1
            Clipboard.SetText .SelText
        End With
    End Sub
    
    Private Sub mnuPaste_Click()
        With RichTextBox1
            .SelText = Clipboard.GetText
        End With
    End Sub
    
    Private Sub mnuSelectAll_Click()
        With RichTextBox1
            .SelStart = 0
            .SelLength = Len(.Text)
        End With
    End Sub

  4. #4
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: cut,copy,paste,select all

    Use Gavio's its much cleaner

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    16

    Re: cut,copy,paste,select all

    what do you mean to RichTextBox1_MouseUp?

  6. #6
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: cut,copy,paste,select all

    Quote Originally Posted by Jose_JR.
    what do you mean to RichTextBox1_MouseUp?
    The right click on RichTextBox popup's the menu with Cut, Copy, Paste and Select All. If you want it on some other control, simply use it's MouseUp event.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width