Results 1 to 10 of 52

Thread: ब्लॉग कोशिश कर रहा है بلاگز کی ک*Trying Blogs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    Full Code "Belt and Braces” in Word Find Replace & String Manipulation of initial Text String in Clipboar

    Full Code "Belt and Braces" in Word Find Replace & String Manipulation of initial Text String in Clipboard


    This code is simply doing the two ways to remove BB Code code tag pairs from a copied to the clipboard Text from a Word document.
    A check is then done Finally to see if the two raped from tags strings are the same.

    I would not be surprised if a fail in the strings match just means that the second method, ( my long string manipulation way ) is getting it wrong.. Lol.. but never mind ***
    ***Edit:
    - like I just did: It will not work for nested BBCode code tags like
    [CENTER][B]Issue Forum for Issues suggestions for improvement Forum for Issues obfuscation[/B][/CENTER]
    This is OK
    [B]Issue Forum for Issues suggestions for improvement Forum for Issues obfuscation[/B]


    That will do for this one, I guess I will have to do a recursion wonk to get a version working with nested BB Code Tag code tags,
    _.____________-

    Ok. Here we go:
    This code _..
    Sub BBCodeCodeTagsWegDaMit2AlanHansPaul2()
    _.. is mostly just splicing together codes
    Sub WegDaMitHansPaulAlan()
    and
    Sub LongWayOfDoingIt()
    along with adding a short section, Rem 10a) to check that the strings are the same. That is to say the
    Full Story selection text from the modified ( removed BB Code code tags ), NewWordText for Code Part 1)
    is
    compared with the final RapedText from the long string manipulation Code part 2)

    The code is all one code and broken down into this and the next three posts

    Code part 1 of 4 parts ( all following parts to be copied directly under the preceding part in the same code module.
    Code:
    Sub BBCodeCodeTagsWegDaMit2AlanHansPaul2() ' http://www.excelforum.com/development-testing-forum/1086445-forum-tools-test-no-reply-needed-4.html#post4586680
    ' === Code assumes you have a Word File open, and have selected some Text
    ' One way is automating doing it in Word.    "Wild Things. You make my heart sing. They make everything….. Groovy"       '_-   http://www.eileenslounge.com/viewtopic.php?f=26&t=26030#p202322
    Rem 0) ' Just mucking about a bit with refering to Word documents
    ' Documents.Item("eileenslounge.docm").Activate
    'Dim DocNme As String               ' ' Prepares "Pointer" to a "Blue Print" (or Form, Questionaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular "Value", or ("Values" for Objects).  There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. A String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quich checks.. But..http://www.mrexcel.com/forum/excel-questions/361246-vbnullstring-2.html#post44116
    ' Let DocNme = ActiveDocument.Name  ' ' '_-So A variable in VBA is like the Link to the part of a URL string reducing size site where a few things about the actual Final site is informed about. This area in that site, like a pigion Hole to which the variable refers, ( the "pigeon hole" location address, and all its contents would be defined as the "Pointer". Amongst other things it has a link, a "Pointing part", pointing to actually where all the stuff is
    Dim Doc As Document 'A variable in VBA is like the Link to the part of a URL string reducing size site where a few things about the actual Final site is informed about. This area in that site, like a pigion Hole to which the variable refers, ( the "pigeon hole" location address, and all its contents would be defined as the "Pointer". Amongst other things it has a link, a "Pointing part", pointing to actually where all the stuff is
     Set Doc = ActiveDocument  'EP Set: Fill or partially Fill: Setting to a Class will involve the use of an extra New at this code line. I will then have an Object referred to as an instance of a Class. At this point I include information on my Pointer Pigeon hole for a distinct distinguishable usage of an Object of the Class. For the case of something such as a Workbook this instancing has already been done, and in addition some values are filled in specific memory locations which are also held as part of the information in the Pigeon Hole Pointer. We will have a different Pointer for each instance. In most excel versions we already have a few instances of Worksheets. Such instances Objects can be further used., - For this a Dim to the class will be necessary, but the New must be omitted at Set. I can assign as many variables that I wish to the same existing instance
    Rem Code Part 1) make two temporary Word Files with and without BB Code
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Code part 2 of 4 parts


    Code:
    Rem Code Part 1) make two temporary Word Files with and withouut BB Code
    Rem 1) Copy selection to Clipboard
     Selection.Copy
    Rem 2) Make temporary WORD document 'Bit of a bodge to get the text in a selection: create a Word file and paste to it
    Dim NextTempDoc As Document '
     Documents.Add: ActiveDocument.Content.Paste 'Make a File Copy in current Application based on Default Type : And Paste from Clipoard ( ...!!!...our original selected text ) using the Default Copy which should at least have all the text, which is all we are interested in here.
     Set NextTempDoc = ActiveDocument ' Do this in case i muck about- I do not want to inadvertently close or kill the wrong document
    '2b) Copy of Full Text with BB Code
    Dim FullFilePathAndFullNameBBCode As String '  'Prepares "Pointer" to a "Blue Print" (or Form, Questionnaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular “Value”, or (“Values” for Objects). There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quick checks.. But...http://www.mrexcel.com/forum/excel-q...html#post44116
     NextTempDoc.SaveAs FileName:="TempBBCodeCopy1.docx", FileFormat:=wdFormatXMLDocument 'Without this the document will not really "exist jet". It has a tempory name ( Used in Windows referrence ), but no path.
     Let FullFilePathAndFullNameBBCode = NextTempDoc.Path & "\" & ActiveDocument.Name
    Rem 3) From Han's Text Find Replacement Dialogue 'http://www.eileenslounge.com/viewtopic.php?f=26&t=22603#p175712
    '3a) Take out all BB Code
     Selection.WholeStory 'Selects whole document which here is just our selection of interest from the original document
    Dim StrOrg As String: Let StrOrg = Selection.Text '11a)6b)' Original Text to use in string manipultion code of Code Part 2)
        With Selection.Find 'This is the VBA code ( or very similar ) used by Excel when Using the Find eplace text Dialogue box. So this is an improved version of what a macro recording would give.
        .ClearFormatting: .Replacement.ClearFormatting    ' Don't use formating, ? not sure this comes into the equation ??
        .Wrap = wdFindStop    ' Tell Word not to continue past the end of the selection ( And therefore prevents also a display Alert asking )
        .MatchWildcards = True
        .Text = "[\[]([!=\]]@)(*\])(*)\[/(\1)\]" ' 8 sections, 4 identified with ( ) but I only need two ( )
        .Replacement.Text = "\3" ' The third of the 4 sections identified with a ( )
        .Execute Replace:=wdReplaceAll    ' Replace all within selection. This is the "OK" button!
        End With
     Selection.WholeStory: Dim NewWordText As String: Let NewWordText = Selection.Text '´11a) New text for comparison with result from Code Part 2)
    '3b) Copy of Colored Text in Word File without BB Code Code tags
    Dim FullFilePathAndFullNameNoBBCode As String
     NextTempDoc.SaveAs FileName:="TempNoBBCodeCopy2.docx", FileFormat:=wdFormatXMLDocument 'Without this the document will not really "exist jet". It has a tempory name ( Used in Windows referrence ), but no path.
     Let FullFilePathAndFullNameNoBBCode = NextTempDoc.Path & "\" & ActiveDocument.Name
    Rem 4) "Reset the "Find Replace Text Dialogue" "Thing" ". if you do not there may be some changed setting there that could catch you out next time you use it.
     NextTempDoc.Select ' Re select the...( actually this line alone seems to do it )
     Selection.WholeStory '...whole document
        With Selection.Find
        .ClearFormatting: .Replacement.ClearFormatting: .Text = "": .Replacement.Text = "":  .Forward = True: .Wrap = wdFindAsk: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = False: .MatchSoundsLike = False: .MatchAllWordForms = False '
        End With
    Rem 5) Optiion to close / kill document
     NextTempDoc.Close (wdDoNotSaveChanges) ' Giving the option will also prevent being asked for it. You must close. VBA will not let you kill an open sheet, as you are affectively working on a copy, and VBA is assumng the Original can be got at by saving for example.  http://www.mrexcel.com/forum/excel-questions/920451-excel-macro-files.html#post4425428
    'Kill FullFilePathAndFullNameBBCode ' Use the Kill wisely!!!!  - where this goes there 'aint no coming back!!
    'Kill FullFilePathAndFullNameNoBBCode
    
    Rem Code Part 2 Put text without BB code into clipboard
    Rem 6) Use data Object ( assumes we copied to the Clipboard )
    '1 a) Data Object to get the data from the clipboard.
         '_- ExPlanation  Dim  :'_-: For Object variabls: Address location to a "pointer". That has all the actual memory locations (addresses) of the various property values , and it holds all the instructions what / how to change them , should that be wanted later. That helped explain what occurs when passing an Object to a Call ed Fucntion or Sub Routine By Val ue. In such an occurance, VBA actually  passes a copy of the pointer.  So that has the effect of when you change things like properties on the local variable , then the changes are reflected in changes in the original object. (The copy pointer instructs how to change those values, at the actual address held in that pointer). That would normally be the sort of thing you would expect from passing by Ref erence.  But as that copy pointer "dies" after the called routine ends, then any changes to the Addresses of the Object Properties in the local variable will not be reflected in the original pointer. So you cannot actually change the pointer.)
          '_- Explanation  Set :'_-: Fill or partially Fill: Setting to a Class will involve the use of an extra New at this code line. I will then have an Object referred to as an instance of a Class. At this point I include information on my Pointer Pigeon hole for a distinct distinguishable usage of an Object of the Class. For the case of something such as a Workbook this instancing has already been done, and in addition some values are filled in specific memory locations which are also held as part of the information in the Pigeon Hole Pointer. We will have a different Pointer for each instance. In most excel versions we already have a few instances of Worksheets. Such instances Objects can be further used., - For this a Dim to the class will be necessary, but the New must be omitted at Set. I can assign as many variables that I wish to the same existing instance
    'Dim objCliTextCopied 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 objCliTextCopied = 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.     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 objCliTextCopied 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 objCliTextCopied = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") ' http://excelmatters.com/2013/10/04/late-bound-msforms-dataobject/
    '6a) Original text string from '11a) The line below means I have nothing to do with the Clipboard yet'  -  see furhter to the right for .Geting From Clipboard for if it had been in it                                                                                                                                                              ' 'Put all?  Clipboard Infomation into Data Object
     objCliTextCopied.SetText Text:=StrOrg  ' I am messing about putting this in data object, then taking it out on 6b) , but I just wanted the code to be more flexible for later use.                             ' ''objCliTextCopied.GetFromClipboard 'All that is in the Clipboard goes in this Data Object initial instance of the Class  This line does not seem to be necerssary for the next Geting Text bit
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

  3. #3
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Code Part 3 of 4 parts

    Code:
    '6b) get code as long string String. This can be very long
    Dim TextWithBBCodeEnit As String '     'Prepares "Pointer" to a "Blue Print" (or Form, Questionnaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular “Value”, or (“Values” for Objects). There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quick checks.. But...http://www.mrexcel.com/forum/excel-q...html#post44116
     Let TextWithBBCodeEnit = objCliTextCopied.GetText() ''retrieve the text in this instance of the Class. ( Our code as a String with probably BB Code Code tags, vbCr vbLf etc.
    Rem 7) Determine length of original text
    Dim LenText As Long '                                      ' Long is very simple to handle, - final memory "size" type is known (123.456 and 000.001 have same "size" computer memory ) , and so a Address suggestion can be given for the next line when the variable is filled in.  '( Long is a Big whole Number limit (-2,147,483,648 to 2,147,483,647) If you need some sort of validation the value should only be within the range of a Byte/Integer otherwise there's no point using anything but Long.--upon/after 32-bit, Integers (Short) need converted internally anyways, so a Long is actually faster. )
     Let LenText = Len(TextWithBBCodeEnit)
     MsgBox prompt:="Text with BB Code Character count is " & LenText
    Rem 8) Take out BB Code bits from text string.
    40   Dim strRmveBBCode As String: Let strRmveBBCode = TextWithBBCodeEnit '  = strBBCode ' This will be adjusted until finally has no BBCode tag pairs
    50   Dim Lstr As Long ' This will be adjusted as necerssary for current length    ' Long is very simple to handle, - final memory "size" type is known (123.456 and 000.001 have same "size" computer memory ) , and so a Address suggestion can be given for the next line when the variable is filled in.  '( Long is a Big whole Number limit (-2,147,483,648 to 2,147,483,647) If you need some sort of validation the value should only be within the range of a Byte/Integer otherwise there's no point using anything but Long.--upon/after 32-bit, Integers (Short) need converted internally anyways, so a Long is actually faster. )
    60    Let Lstr = Len(TextWithBBCodeEnit)                                ' Len(strBBCode)
    70   Rem 2) Loop through and get a BB Code section
    80   Dim strBBCodePair As String ' for a found valid pair  '
    ' Prepares "Pointer" to a "Blue Print" (or Form, Questionaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular “Value”, or (“Values” for Objects).  There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. A String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quich checks.. But..http://www.mrexcel.com/forum/excel-questions/361246-vbnullstring-2.html#post44116
    90   Dim posCurrent As Long 'Current position in the string' Loop Bound variable Count '_-Main Loop==========================
    100      For posCurrent = Lstr To 2 Step -1 'Important to go backwards as we chop off behind us so have a less complicated current position. We look at pos-1 in some code parts so we would error if we went back to less than 2
    110      '2a) Check for a ]
    120          If Mid(strRmveBBCode, posCurrent, 1) = "]" Then
    130          Dim posBBCodeTagSrch As Long 'For search through possible valid BBCode Section'_-Loop for Pos tag pair section--
    140          Dim BcrdEEnd As Long: Let BcrdEEnd = posCurrent 'Position of possible End Code Tag End
    150                For posBBCodeTagSrch = posCurrent - 1 To 2 Step -1 'PosCurrent is set here at loop start. ###It is not effected by cardinally sining changing PosCurrent Loop Bound variable caount in Outer main Loop
    160                  If Mid(strRmveBBCode, posBBCodeTagSrch, 1) = "]" Then GoTo NxtCESPosPos ' If we hit another ] then start again to see if is a valid BB code section
    170                  If Mid(strRmveBBCode, posBBCodeTagSrch, 1) = "/" And Mid(strRmveBBCode, posBBCodeTagSrch - 1, 1) = "[" Then 'We hit start of a BB Code end tag
    180                  Dim BcrdESt As Long: Let BcrdESt = posBBCodeTagSrch - 1   'Position of End Code Tag Start
    190                   Exit For ' We leave this For the End Code Tag Start Search, Exit For with a [ at posBBCodeTagSrch-1
    200                  Else 'Not found start of end Tag or stop of end Tag.
    210                  End If
    220 NxtCESPosPos:  Next posBBCodeTagSrch ' go back in possible BB code string
    230          If posBBCodeTagSrch = 3 Then Exit Sub 'case we never found the start of an End Code Tag
    240                For posBBCodeTagSrch = posBBCodeTagSrch - 2 To 2 Step -1 ' Once again ### the start is set and fixed, the Loop Bound Variable Count will change
    250                  If Mid(strRmveBBCode, posBBCodeTagSrch, 1) = "]" Then
    260                  If Mid(strRmveBBCode, posBBCodeTagSrch - 1, 1) = "]" Then GoTo NxtCSSPosPos ' If we hit another ] then start again to see if is a valid BB code start section
    270                  Dim BcrdSEnd As Long: Let BcrdSEnd = posBBCodeTagSrch  'Position of possible Start Code Tag End
    280                  Dim LTagStLoop As Long 'Last loop to find start of start Code Tag
    290                      For LTagStLoop = posBBCodeTagSrch - 1 To 1 Step -1 '_- Second inner loop___________________________
    300                          If Mid(strRmveBBCode, LTagStLoop, 1) = "[" Then
    310                          Dim BcrdSSt As Long 'Have to put it here, - I may occaisionally have to set it to 0 in next line
    320                          If Mid(strRmveBBCode, LTagStLoop + 1, 1) = "/" Then Let BcrdEEnd = BcrdSEnd: Let BcrdSEnd = 0: Let BcrdESt = LTagStLoop: Let BcrdSSt = 0: Let posBBCodeTagSrch = LTagStLoop: GoTo NxtCSSPosPos ' Found a second end Code Tag. So change the previous found start and stop , and adjust the Loop Bound variable Count appropriately for a new search for a start Code Tag
    330                           Let BcrdSSt = LTagStLoop
    340                           Let posCurrent = BcrdSSt 'End of Code Tag section search
    350                           GoTo FkOffCrd ' We leave this For the start Code Tag Start Search and go to Fuk Off Crd:
    360                          Else ' Still looking for start of start Code Tag
    370                          End If
    380                      Next LTagStLoop '_- Second inner loop________________________________________________________________
    390                      If LTagStLoop = 1 Then GoTo TheEnd 'Case we found a start start [ at 1 or failed to find a start start [ for the complete possible Code Tag section search
    400                  Else 'Not found end of start Tag or start of start Tag
    410                  End If
    420 NxtCSSPosPos:  Next posBBCodeTagSrch ' go back in possible BB code string'_-Loop for Pos tag pair section-----------------
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

  4. #4
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Code part 4 of 4 parts



    Code:
    430 FkOffCrd:  Rem 3) "I think we come here with a complete set of 4 positions"
    440              If BcrdEEnd <> 0 And BcrdESt <> 0 And BcrdSEnd <> 0 And BcrdSSt <> 0 Then 'Just to check'
    450              Dim SttBcrd As String, StpBcrd As String ' Start and stop tags
    460               Let SttBcrd = Mid(strRmveBBCode, BcrdSSt, BcrdSEnd - BcrdSSt + 1): Let StpBcrd = Mid(strRmveBBCode, BcrdESt, BcrdEEnd - BcrdESt + 1)
    470              Dim SttWrd As String, StpWrd As String          ' like |Color=Red|, |/Color|
    480               Let StpWrd = Mid(StpBcrd, 3, Len(StpBcrd) - 3) ' like Color from |/Color| - Whole Word, from 3rd Chr , for Length as  WholeWord-3
    490               Let SttWrd = Mid(SttBcrd, 2, Len(StpWrd))      ' like Color from |Color=Red|
    500                  If UCase(SttWrd) = UCase(StpWrd) And Mid(StpBcrd, 2, 1) = "/" Then 'Ucase allows for differences in cases                                     And Mid(SttBcrd, Len(SttWrd) + 2, 1) = "=" Then
    510                   Let strRmveBBCode = Replace(strRmveBBCode, SttBcrd, "", 1, 1) ' Replace in ( strRmveBBCode , the start tag , with no string , start loooking from and return from character 1 )
    515                   Let strRmveBBCode = Replace(strRmveBBCode, StpBcrd, "", 1, 1)
    520                  Else 'No shortening of string foe invalid tag word
    530                  End If
    540          Else ' no last ] of a possible Code section yet, so keep going back down in the main string
    550          End If
    560      Else
    570      End If
    580      Next posCurrent '_-===Main Loop========================================================================================
    '590 TheEnd:
    600   MsgBox prompt:="" & strRmveBBCode & "": Debug.Print "" & strRmveBBCode & "" 'Hit Ctrl+g when in VB Editor Window,  reveal Immediate window after code run
    Dim RapedText As String: Let RapedText = strRmveBBCode ' TextWithBBCodeEnit with BB Code Code tags removed
    Rem 9) This a Another Object from class to be sure we have the data in the Clipboard
    'Dim objDat As DataObject
     'Set objDat = New DataObject 'Set to a new Instance ( Blue Print ) of dataobject
    Dim objDat As Object
     Set objDat = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    '9b) Put in (and Get back from clipboard) the raped text.
     objDat.SetText Text:=RapedText 'Make Data object's text equal to original text without the BB Code Code Tags
     objDat.PutInClipboard    'Place current Data object into the Clipboard
     objDat.GetFromClipboard  'All that is in the Clipboard goes in this Data Object second instance of the Class.
    Dim TxtOut As String: Let TxtOut = objDat.GetText() 'retrieve the text in this second instance of the Class. ( In this case all in it is the text and possibly vbCr and vbLf )
    MsgBox prompt:="You dumped in Clipboard this " & vbCr & RapedText & vbCr & "and if you try to get it, you should get" & vbCr & TxtOut & ""
    Rem 10a) Code Part 3) Belt and braces check. A check is then done finally to see if the two raped from tags strings are the same
        If NewWordText <> RapedText Then MsgBox prompt:="Text from Word Dialogue Box Find Replace Wild card way, and " & vbCrLf & "Long String manipulation way are not the same. Oh dear"
    '10b) Tidy up.
    TheEnd:  ' ( Come here always, even on a unpredictable error ) or i wouod If i had an error Handler, Lol.
     Set objDat = Nothing '   Good practice...   maybe....
     Set objCliTextCopied = Nothing '  .......   http://www.mrexcel.com/forum/excel-questions/361246-vbnullstring.html#post4414065
    
    End Sub
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •