Clipboard Spam Link Wonks
In Excel columns I have the URLs, and I copy them
Then I look at what is in the clipboard with the aim of adding enough BB Code URL tags
This is what two links look like
Code:
"https" & ":" & "/" & "/" & "www" & "." & "youtube" & "." & "com" & "/" & "watch" & "?" & "v" & "=" & "pGcerfVqYyU" & "&" & "lc" & "=" & "UgwYnetS3HRljX9vOLx4AaABAg" & "." & "94UVSldHOOy9VDJUb" & "_" & "mRBH" & vbCr & vbLf & "https" & ":" & "/" & "/" & "www" & "." & "youtube" & "." & "com" & "/" & "watch" & "?" & "v" & "=" & "pGcerfVqYyU" & "&" & "lc" & "=" & "UgzCtsi4abaxZnZJjZR4AaABAg" & vbCr & vbLf
Fortunately, no surprises, so we just need to add the BB Code URL tags in some convenient way. First thought is to replace the vbCr & vbLf with [/url] & vbCr & vbLf and replace the http with [url] & http
The we put the modified string back in the clipboard
Code:
Option Explicit
'https://excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA/page5
'https://excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA?p=16480&viewfull=1#post16480
'https://excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA/page5#post16480
Sub CopyExcelColumnSpamURL()
Selection.Copy ' This will put it in the clipboard
'Dim objCliCodeCopied As DataObject '**Early Binding. This is for an Object from the class MS Forms. This will be a Data Object of what we "send" to the Clipboard. So I name it CLIpboardSend. But it is a DataObject. It has the Methods I need to send text to the Clipboard
' Set objCliCodeCopied = New DataObject '**Must enable Forms Library: In VB Editor do this: Tools -- References - scroll down to Microsoft Forms 2.0 Object Library -- put checkmark in. Note if you cannot find it try OR IF NOT THERE..you can add that manually: VBA Editor -- Tools -- References -- Browse -- and find FM20.DLL file under C:\WINDOWS\system32 and select it --> Open --> OK. https://web.archive.org/web/20140610055224/http://excelmatters.com/2013/10/04/late-bound-msforms-dataobject/
' ( or instead of those two lines Dim obj As New DataObject ). or next two lines are.....Late Binding equivalent'
Dim objCli As Object ' Late Binding equivalent' If you declare a variable as Object, you are late binding it. https://web.archive.org/web/20141119223828/http://excelmatters.com/2013/09/23/vba-references-and-early-binding-vs-late-binding/
Set objCli = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") ' https://web.archive.org/web/20140610055224/http://excelmatters.com/2013/10/04/late-bound-msforms-dataobject/
objCli.GetFromClipboard 'All that is in the Clipboard goes in this Data Object initial instance of the Class
Dim SpamURLs As String ' String varable to take the moodified code. This can be very long, like my cock
Let SpamURLs = objCli.GetText() 'retrieve the text in the initial instance of the Class. ( In this case the original code modifies to have code lines )
' Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(SpamURLs)
Let SpamURLs = Replace(SpamURLs, vbCr & vbLf, "[/uRl]" & vbCr & vbLf, 1, -1, vbBinaryCompare)
Let SpamURLs = Replace(SpamURLs, "http", "[uRl]http", 1, -1, vbBinaryCompare)
' Make a data Object to put back in clipboard. This a Another Object from class just to demo, could have used the first
'Dim objDatCliBackIn As DataObject
' Set objDatCliBackIn = New DataObject 'Set to a new Instance ( Blue Print ) of dataobject
Dim objDatCliBackIn As Object
Set objDatCliBackIn = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
objDatCliBackIn.SetText "Alan Spam Tests" & vbCr & vbLf & SpamURLs 'Make Data object's text equal to the long string of the modified code
objDatCliBackIn.PutInClipboard 'Place current Data object into the Clipboard, effectivelly putting its text, which is oue final code in the Clipcoard
End Sub