Good morning,
I am trying to figure out how to use VBA to put a message with text and clickable URLs into the clipboard. To further complicate matters, I use a PutInClipboard workaround (which works fine) because PutInClipboard does not work for me unless my file explorer is closed. Below is what I have, which I think is a long way from working but demonstrates what I'm trying to achieve.
The desired clipboard contents would be:
Please use the URL below:
Google
_______________________________________________
Gmail is the ultimate destination for the copied contents.
Thanks,
Barklie
I am trying to figure out how to use VBA to put a message with text and clickable URLs into the clipboard. To further complicate matters, I use a PutInClipboard workaround (which works fine) because PutInClipboard does not work for me unless my file explorer is closed. Below is what I have, which I think is a long way from working but demonstrates what I'm trying to achieve.
VBA Code:
Sub CopyMessage()
'Dimension variables
Dim String2 As Range
'Assign variables
String1 = "Please use the URL below:" & Chr(13) & Chr(13)
With String2
.Address = "www.google.com"
.TextToDisplay = "Google"
End With
Message = String1 & String2
'Copy message to clipboard
ClipboardMessage = CreateObject("htmlfile").parentWindow.clipboardData.setData("Text", Message)
End Sub
The desired clipboard contents would be:
Please use the URL below:
_______________________________________________
Gmail is the ultimate destination for the copied contents.
Thanks,
Barklie