Copying to Clipboard through Toolbar
I´m using this code:
VB Code:
Public Sub submnuCopy_Click()
Clipboard.Clear
If TypeOf Screen.ActiveControl Is TextBox Then
Clipboard.SetText Screen.ActiveControl.SelText
ElseIf TypeOf Screen.ActiveControl Is ComboBox Then
Clipboard.SetText Screen.ActiveControl.Text
ElseIf TypeOf Screen.ActiveControl Is PictureBox Then
Clipboard.SetData Screen.ActiveControl.Picture
ElseIf TypeOf Screen.ActiveControl Is ListBox Then
Clipboard.SetText Screen.ActiveControl.Text
Else
' No action makes sense for the other controls.
End If
End Sub
How do I do to make it work through a Toolbar. The problem is that if I click on the Copy button, I'm getting that the Screen.ActiveControl is set to nothing. How do I change this?