2楼的好复杂
看不懂
看不懂
Private Declare Function SendMessage Lib "user32" Alias "SendMessageW" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Const WM_COPY As Long = &H301 Const EM_SETSEL = &HB1& Private Sub Command2_Click() Text1.Text = Format(Rnd * 100, "#0.0000000") SendMessage Text1.hWnd, EM_SETSEL, 0&, -1& '选择要复制的文本内容,第三个参数是启始位置,第四个参数是结束位置; SendMessage Text1.hWnd, WM_COPY, 0&, 0& '复制Text1中被选中的文本内容。 MsgBox Clipboard.GetText End Sub Private Sub Command1_Click() Text1.Text = Format(Rnd * 100, "#0.0000000") Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) Clipboard.SetText Text1.SelText MsgBox Clipboard.GetText End Sub