VBA:クリップボードの値貼り付け&コピー


Private Sub SetCB(ByVal str As String)
'クリップボードに文字列を格納
  With CreateObject("Forms.TextBox.1")
	.MultiLine = True
	.Text = str
	.SelStart = 0
	.SelLength = .TextLength
	.Copy
  End With
End Sub

Private Sub GetCB(ByRef str As String)
'クリップボードから文字列を取得
  With CreateObject("Forms.TextBox.1")
	.MultiLine = True
	If .CanPaste = True Then .Paste
	str = .Text
  End With
End Sub