Here is what I have so far
Code: Select all
With ActiveSheet
.Range("A1").Select
.Copy
.PutInClipboard
End With
Range("A2").Select
Code: Select all
With ActiveSheet
.Range("A1").Select
.Copy
.PutInClipboard
End With
Range("A2").Select
Code: Select all
Dim objData As MSForms.DataObject
Set objData = New MSForms.DataObject
objData.SetText Range("A1").Text
objData.PutInClipboard
Code: Select all
Sub M_snb()
cells(1).copy
With GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
.GetFromClipboard
msgbox .GetText
End With
End Sub
Code: Select all
Sub M_snb()
With GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
.SetText "This is what I mean"
.PutInClipboard
.GetFromClipboard
msgbox .GetText
End With
End Sub
Which Clipboard? ( I think we have a Windows Clipboard, an Office Clipboard and an Excel Clipboard, and possibly some others I don’t know about yet? )
That was a bit of an uneducated Guess on my behalf based on two things:
Which Clipboiard, and how do I get at the information in it so as to paste in the full pretty formatted version which I copied before I closed the workbook…
I am glad you said that and not me, Lol. Watch your back, though. If I ever say things like that then either I am banned on the spot and all my posts deleted, or more often, on a deferred render' type mode, I am put on a list of marked men to be killed off subtly later when no one is watching anymore
HansV wrote: ↑10 Nov 2022, 19:44...
Use code like this:Code: Select all
Dim objData As MSForms.DataObject Set objData = New MSForms.DataObject objData.SetText Range("A1").Text objData.PutInClipboard
Hello,
Code: Select all
Sub WotsInTHEClipboard()
Dim objDataObject As Object
Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") ' http://web.archive.org/web/20200124185244/http://excelmatters.com/2013/10/04/late-bound-msforms-dataobject/
Dim StringBack As String ' This has the entire text held for the range
ThisWorkbook.Worksheets.Item(1).Range("A1").Copy ' Or as alternative copy manually - it usually has the same effect, copies from the Excel worksheet, I think
objDataObject.GetFromClipboard
Let StringBack = objDataObject.GetText()
Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(StringBack)
'Stop ' From VB Editor hit Ctrl+g to get the Immediate window. You should see "abc" & vbCr & vbLf
''
' objDataObject.Clear
objDataObject.settext ThisWorkbook.Worksheets.Item(1).Range("A1").Value2
objDataObject.putinclipboard
objDataObject.GetFromClipboard
Let StringBack = objDataObject.GetText()
Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(StringBack)
' In the Immediate window you should see "abc"
End Sub
Code: Select all
Private Sub Worksheet_SelectionChange(ByVal Target As Range) ' https://eileenslounge.com/viewtopic.php?p=303007#p303007
If Target.Cells.Count <> 1 Or Target.Column <> 3 Then Exit Sub ' I am only intersted in copying the text from a single cell in column C
Dim objDataObject As Object
Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") ' http://web.archive.org/web/20200124185244/http://excelmatters.com/2013/10/04/late-bound-msforms-dataobject/
objDataObject.SetText Target.Value2
objDataObject.putinclipboard
End Sub
Code: Select all
Sub M_snb()
With GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
Cells(1).Copy
.GetFromClipboard
MsgBox "A1 " & vbTab & Cells(1) & vbTab & Len(Cells(1)) & vbLf & "clipboard " & vbTab & .GetText & vbTab & Len(.GetText)
.settext ""
.PutInClipboard
MsgBox "clipboard " & vbTab & .GetText & vbTab & Len(.GetText)
End With
End Sub
Code: Select all
Sub WotGetGotGiven_abcdeedumA3B4() ' https://eileenslounge.com/viewtopic.php?p=303015#p303015
Dim objDataObject As Object
Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") ' http://web.archive.org/web/20200124185244/http://excelmatters.com/2013/10/04/late-bound-msforms-dataobject/
Dim StringBack As String '
ThisWorkbook.Worksheets.Item(1).Range("A3:B4").Copy ' Or as alternative copy manually
objDataObject.GetFromClipboard
Let StringBack = objDataObject.GetText()
Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(StringBack)
' Result example "a" & vbTab & "b" & vbCr & vbLf & "c " & vbTab & "deedum" & vbCr & vbLf
End Sub