After running cod to put in vbCR
HTML Code:' http://www.eileenslounge.com/viewtopic.php?f=26&t=22603&start=20#p176255 http://www.excelfox.com/forum/f13/bbcode-table-2077/#post9687 ( Manual Solution Alternative: http://www.excelfox.com/forum/f13/bbcode-table-2077/#post9645 ) Sub PutInAvbLfInClipboadText() ' "Replcace vbCr with vbCr & vbLf " 'Get Current Text from Clipboard Dim objDat As dataobject Set objDat = New dataobject 'Set to a new Instance ( Blue Print ) of dataobject 'Dim obj As Object 'Set obj = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") objDat.GetFromClipboard 'All that is in the Clipboard goes in this Data Object instance of the Class. Let TxtOut = objDat.GetText() 'retrieve the text in this instance of the Class. ( In this case all I have in it is the text typically I think as it is coming from a Ctrl C Copy from the VB Editor ) Dim originalClipboardText As String: Let originalClipboardText = TxtOut Dim TextWithExtravbLF As String Let TextWithExtravbLF = Replace(TxtOut, vbCr, vbCr & vbLf, 1, -1) 'Dump in Clipboard: This second instance of Data Object used to put in Clipboard Dim objCliS 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 objCliS = 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. ' ( or instead of those two lines Dim obj As New DataObject ). or next two lines are.....Late Binding equivalent' 'Dim obj As Object' Late Binding equivalent' If you declare a variable as Object, you are late binding it. http://excelmatters.com/2013/09/23/vba-references-and-early-binding-vs-late-binding/ 'Set obj = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")' http://excelmatters.com/2013/10/04/late-bound-msforms-dataobject/ objCliS.SetText TextWithExtravbLF 'Make Data object's text equal to a copy of ORefiginalText objCliS.PutInClipboard 'Place current Data object into the Clipboard ' Get from clipboard. This a Another Object from class to be sure we have the data in the Clipboard MsgBox prompt:="You dumped in Clipboard originally this " & vbCr & TxtOut & vbCr & "and if you try to get it, you should get" & vbCr & TextWithExtravbLF & "" ' End clean up. 'TheEnd: ' ( Come here always, even on a unpredictable error ) Set objDat = Nothing ' Good practice... maybe.... Set objCliS = Nothing ' ....... http://www.mrexcel.com/forum/excel-questions/361246-vbnullstring.html#post4414065 End Sub




Reply With Quote
Bookmarks