Results 1 to 5 of 5

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

  1. #1
    Senior Member DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    274
    Rep Power
    3

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

    Trying Blogs ब्लॉग कोशिश कर रहा है ബ്ലോഗുകൾ ശ്രമിക്കുന്നു
    بلاگز کی کوشش کر رہے




    The purpose of this Thread is the following:
    इस धागे के उद्देश्य निम्नलिखित है:
    ഈ ത്രെഡ് ഉദ്ദേശ്യം പിന്തുടരുന്നു:
    :یہاں مقصد مندرجہ ذیل ہے


    Codes and Information is here.
    संहिताओं और सूचना यहाँ हैं।
    കോഡുകൾ സമവാക്യങ്ങളേയും വിവരങ്ങൾ ഇവിടെ ഉണ്ട്.
    کوڈز اور معلومات یہاں پایا جائے.


    1)
    To be referenced in this web site
    इस वेब साइट में संदर्भित किया जा करने के लिए
    ഈ വെബ് സൈറ്റിൽ പരാമർശിച്ചിരിക്കുന്ന ലഭിക്കണമെങ്കിൽ
    ان خطوط اس ویب سائٹ سے محولہ کیا جائے گا

    2)
    Also to be referenced from other web sites
    इसके अलावा अन्य वेब साइटों से संदर्भित किया जा करने के लिए
    മറ്റ് വെബ് സൈറ്റുകളിൽ നിന്നുള്ള പരാമർശിച്ചിരിക്കുന്ന ചെയ്യുവാൻ
    اس کے علاوہ دیگر ویب سائٹس سے محولہ کیا جا کرنے


    This has been agreed with the Administrator
    यह व्यवस्थापक द्वारा सहमति व्यक्त की है
    ഈ അഡ്മിനിസ്ട്രേറ്റർ സമ്മതിച്ചു ഉണ്ടായിരുന്നു
    یہ ایڈمنسٹریٹر کی طرف سے اس بات پر اتفاق کیا ہے


    Alan
    Google first, like this site:ExcelFox.com "Short Title or Theme of wot youre looking for"
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE:
    Tools for that:
    http://www.excelfox.com/forum/showth...=9821#post9821
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/

  2. #2
    Senior Member DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    274
    Rep Power
    3

    VBA Remove BB Code Code Tags in text

    VBA Remove BB Code Code Tags in text

    In the next post is a code to remove BB Code Code Tags in text

    This code is slightly redundant since I was given a simpler one ,
    http://www.eileenslounge.com/viewtop...202145#p202122
    which probably is more Full proof !
    But I include it here with description for future reference. I may use it in a following code or codes to cross check the results given.
    The code is intended to remove valid BB Code Code Tag sections from a Text string.
    In this case, valid means in terms of the syntax, which is basically as follows

    [TagWord=Some]Any text[/TagWord] or [B]Any text[/b]

    An arbitrary string is given initially in code section Rem 1)
    "gggg[d=fg]2[/d]45[/8]x[ddd[Cl=XYZ][/Cl][B]Any text[/b]"


    Then the main code is as follows

    Rem 2 Brief Code description
    The code works backwards 100 through the whole string. It looks at a character at a time.
    120 __ On If finding a ] , it notes the position of it,
    140 BcrdEEnd, then keeps going back.
    160___If it finds another it notes that as the ] position and carries on going back.
    170 It determines the position of a [ , BcrdESt, by looking for a [\
    It starts looking again for the next ] ,
    250 _____If a ] is found, it checks
    260 _____If the next character back is another ], Then it keeps going back. If the next character back was Not a ] , then the position of the ], BcrdSEnd, is
    270 noted
    A new last loop 290 starts going further back to look for a [
    300 ________If it finds a [ , it notes that, BcrdSSt.
    320 ________If in the unlikely event that it is a start of an end , like [\ then we have found a second End BB Code Code Tag so we do like_..
    BcrdEEnd = BcrdSEnd:
    BcrdESt = BcrdSSt:
    BcrdSEnd=0:
    ( BcrdSSt=0 )
    _..and go back and start again looking for the start tag. Otherwise the start position of the start tag, BcrdSSt, is noted, then it is finally time to go and think about getting rid of the code tag pair whose positions have now been determined....
    430 FkOffCrd:
    _..So I come to a point, aptly named, Rem 3) "I think we come here with a complete set of 4 positions". So I try to take the BB Code Code Tags out. As I am going backwards, the new string with the missing Code Tag pair does not mess up me going through the characters as I took off stuff “behind me”
    450 I overdo the use of variables here because I can and do, but also because a development of the code might be to look through a list of available BB Code Code Tags to check I have them . I do one quick validity check: I check that the word after the / in the End BB Code code tag is the same as the word in the start BB Code code tag ( that before an = , if there is an = ) . Only
    500____ If this condition ( which must be met for a valid BB Code code tag ) is met are the pair of tags removed by replacing them with , . Another condition is also checked: a / in second character of the stop tag.

    Either from going through a code section search with possible removal, or ,
    540 Else not , we are at the Next posCurrent of the main going backward Loop,
    580 , so keep going back looking for another, or a first possible start ( looking from the back ).
    Hopefully, for example at line 340, posCurrent would have been reduce to allow for the inner Loops going back in a code tag section search.


    _................................

    The code returns the string:
    gggg245[/8]x[ddd[B]Any text[/b]
    Last edited by DocAElstein; 02-11-2017 at 10:59 PM.
    Google first, like this site:ExcelFox.com "Short Title or Theme of wot youre looking for"
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE:
    Tools for that:
    http://www.excelfox.com/forum/showth...=9821#post9821
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/

  3. #3
    Senior Member DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    274
    Rep Power
    3
    Code described and ExPlained in last post


    Code:
    Sub LongWayOfDoingIt()
    10   Rem 1) Test string
    20   Dim strBBCode As String '
    30    Let strBBCode = "gggg[d=fg]2[/d]45[/8]x[ddd[Cl=XYZ][/Cl]Any text"
    40   Dim strRmveBBCode As String: Let strRmveBBCode = 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(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-----------------
    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
    End Sub
    Last edited by DocAElstein; 02-11-2017 at 11:14 PM.
    Google first, like this site:ExcelFox.com "Short Title or Theme of wot youre looking for"
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE:
    Tools for that:
    http://www.excelfox.com/forum/showth...=9821#post9821
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/

  4. #4
    Senior Member DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    274
    Rep Power
    3

    Wild Things. You make my heart sing. They make everything.. Groovy

    The VBA code in the last few posts is a bit of a long way around of doing what can be done in a Word Dialogue box type thing using Wild things:
    http://www.gmayor.com/replace_using_wildcards.htm
    http://imgur.com/4Nqj1HP

    The problem is getting at the Wild Things needed in the Wild Find String.

    I can’t do it. But Hans and Paul did it for me here:
    http://www.eileenslounge.com/viewtop...=26030#p202107

    Here is my attempt at an ‘ExPlanation of the solution:

    Wild Things. You make my heart sing. They make everything….. Groovy


    Wild Things. You make my heart sing. They make everything….. Groovy
    http://listenonrepeat.com/watch/?v=H...s_-_Wild_Thing
    Wild things…. I think I hate you .. But I wanna know for sure… so

    A Summary
    As example. We want to remove the start and stop tags in a sample string containing a start and stop tag such as this_..
    [color=Green]This is green[/color] This ‘aint matey

    _.. What we finally want is this:
    This is green This ‘aint matey

    We use a combination of Wild things , or like a pattern to search for [ Find ] any bits like _..
    [color=Green]This is green[/color]
    _.. and [ Replace ] that “Find”ed with
    This is green

    We can do, it Wildly, man, as follows:
    As always the search is done from left to right

    The way I do it below is probably not the most efficient way, in fact it is probably pretty stupid, but is just to demo the idea
    Optional use of ( ) in the Wild thing search string
    We can use brackets ( ) , optionally , to identify, ( for later use ) , the exact string parts found by the constituent Wild things in the ( ) in which they are in:
    So in this example we will use a ( ) for
    _ the Wild things that find the color so that the actual word color can be used again in the same wild stuff string, so as to make sure that we find in the end tag the matching word to that in the start tag.
    _ Also we need a ( ) to identify the wild things that Find This is green , as we want to use that in , or rather for the complete, Replace string.
    A bracket is identified by , for example, \2 if I want to reference the actual string found by the wild things we enclose in the second ( )

    Build up final Wild thing Replace string, left to right, by breaking string we want up into bits. Each bit will be found by a Wild thing or things
    So we are looking to break the to search for Wild [ Find ] Thing string down thus:
    Code:
    [ & ( AnythingWithout=or] )  & anything &  ]  & (Anything) &  [\ & \1 & ]
    So I am breaking it down in to 8 bits. So I need 8 sections of wild stuff to Find those.
    \1 is at the 7th position and refers to what is actually found by the search for ( AnythingWithout=or] ) at position 2 ( which is bracket ( ) number 1 )


    Excel starts at the left. What no literature really states clearly ( and is only obvious once you know it ) is this:
    _ For most sections, Excel keeps going to the right until it Finds what the Wild thing tells it to. That is then stored, but only if that found string also has joined to it the string type in the next section’s Wild thing. Those two sections are then stored ( as well as storing separately if either of those two sections are enclosed in ( ) ), but only if that found string also has joined to it the string type in the next section’s Wild thing. That is then stored, but only if that found string also has joined to it the string type in the next section’s Wild thing. ……..etc.
    A common Wild thing is * . This means anything characters and any amount. This will only include, however, anything up to if and when the next Wild thing is satisfied.

    The 7th Wild thing I already have which is \1 which is referring to the 1st bit enclosed in a ( ) , which is the second bit in the broken up string , ( which is anything without a = or a ] . In our example this will be color) . Note: The number refers to the number from the left of any ( ) that I may have included, not the actual sections.
    Just to make that last point clear, and to demonstrate another, I will do this_..
    Code:
    [ & ( AnthingWithout=or] ) & ( Anything &    ] ) & (Anything) & [/ & \1 & ]
    _.. so my Replace is then \3 . I do not need the second ( ___ ) , which I could reference by \2, ( and it can help to result in an “expression too complex” error ! ).
    I put the second ( ___ ) in also to demo that a ( __ ) can include more than one wild bit



    So here is one example Find sting with Wild things that “works” ( I added spaces to show better the 8 sections, but in use those spaces must be removed ). There are three optional ( ) sections. The second ( ) section encloses two Wild thing sections: Those are the third and forth counting from the left.

    Code:
     [\[]    ([!\]=]@)    (*     \])    (*)    \[/    (\1)     \]
    This is the actual Wild Find string
    ___ [\[]([!=\]]@)(*\])(*)\[/(\1)\]

    To '_- ExPlain the 8 parts:
    Part 1 [\[]
    Excel start “looking” from the left to find a [
    As a general rule Wild things are enclosed in a [ ] pair to identify them as such. So a [ ] is a Wild thing. They do not always have to be enclosed in a [ ], as is the case here. Here we are effectively looking to Find a single simple character, [.
    ( In the final Find string, only the second Wild section needs to be enclosed partly in a [ ] pair ).
    So this section written as \[ instead is just as good. I suspect my use of the extra [ ] here does not have any bad effects, as it might be that the final string would be at compile or whatever reduced to \[ in either use of \[ or [\[]
    We need to use the Wild thing, \ , quite a bit , in our total string for the same reason that we do here: This is because the \ has another use in Wild things in addition to the already discussed way like \7 ( where 7 would be for the 7th ( ) ). This other use of \ is to allow us to use characters as simple text which have a specific use in Wild things, so that Excel knows that we want to use them as their literal text string, rather than as Wild thing. Here it is needed for the first [ which we want to find.
    ( It follows that if we were looking for a \, then we would need to use \\ )
    In our example string we find with this first Wild thing section the first [

    Part 2 ([!\]=]@)
    As noted the ( ) allows the string actually found in this Wild bit to be used later to the right via the reference \1.
    As for this:
    [!\]=]@ ( which could just as well be written [!=\]]@ )
    We need a [ ] pair here, as within that is part of the Wild instructions for what to search for , and that has a further Wild instruction, @ , applied to that.
    So in such a [ ] pair we would normally expect some specific wild stuff
    Here the Wild thing, ! , means we search for any character other than those after included up to the closing tag ]. In our sample string , our first Wild bit found the first [ which now has added on any string at the next character if it is not a = or a ]
    So this part of the second wild bit will find c in our sample string. If we had no other wild instructions here, then Excel would be content/ satisfied with that c. That would be joined on to the first [ found, so our result so far would be [c . In effect Excel stops going to the right when it is satisfied, and goes on to the next Wild bit. But we have another wild instruction here: The @ instructs to look for any amount of characters meeting the conditions before it, in this case the conditions in the [ ]. So the “Find” will stop finding characters when it no longer has a not = or a not ]. In our sample string the characters meeting the conditions are tacked on to a [ so will be will be [color. What [!\]=]@ has actually found and what the brackets ([!\]=]@) can be thought of as “holding” is color.
    An alternative for @ would be {1,} which looks for between 1 and any amount of what is before it.
    If we had used {1,4} or {2,4} instead of @ we would have so far for the complete found string [colo
    If we had used {5,5} we would not have found a matching code tag word with less than 5 characters.

    Parts 3 and 4 (*\])
    This is unnecessarily in ( ) . *\] will do
    The literature says * looks for any amount of anything. I think that is not strictly correct, or at least, explains it badly. It would appear to look for any amount of anything only until the next wild condition is met. That is why I chose to put it in ( ) just to demo the dependence, as it were. But this (*)(\]) or this *\] would work just as well (*)(\]).
    Once again the \ is required for telling Excel that we want it to recognise ] as a string rather than a specific Wild thing. For this section , with my example string, I get from this complete 2 part Wild section
    =green]
    If our code tags were of the form like: [b]SomeBoldText[/b] , then the search would have “stopped before it started”, as it were, as the ] would have “stopped” it
    The combination of the 2 part Wild sections in this case would return just the single text character ]


    Parts 5 and 6 (*)\[/
    I contradict what I said in the last section slightly by using a ( ) around the * . Once again the * does nothing useful without the next wild bit to “stop” it. But what it does Find before it “stops” is what we actually need for Replace string. Hence I need a ( ) to reference what it Finds. This total Part 5 and part 6 section returns in our example
    This is green[/
    and the part referenced inside the ( ) is
    This is green

    Part 7 (\1)
    As discussed already here the Wild thing, \1 , instructs to Find a string equal to that actual text found in the first ( ) if it is just before the next to be found ( which we will see in the next Part is the last character pair found, [/ ). The actual string found by [!\]=]@ in Part 2 , was , in our example the text color

    Part 8 \]
    Finally only a complete final Find attempt is successful if the last character is a ] , that is to say if the character after the text, in our example, the second color, is a ]

    _...

    The Final “Find”ed String for our example would be

    [ & color & =Green & ] & This is green & [/ & color & ]
    Last edited by DocAElstein; 02-14-2017 at 08:52 PM.
    Google first, like this site:ExcelFox.com "Short Title or Theme of wot youre looking for"
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE:
    Tools for that:
    http://www.excelfox.com/forum/showth...=9821#post9821
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/

  5. #5
    Senior Member DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    274
    Rep Power
    3
    Here is a simple code to use the Find and Replace discussed in the last Post
    The code should go in a code module in a WORD .docm File
    Before rung the code, a text which includes BBCode Code Tags , should be selected in a Word document.

    The Code makes a temporary File, "TempBBCodeCopy1.docx", holding the original selected text, then removes the BB Code Code Tags from the text and saves that as another temporary File, "TempNoBBCodeCopy2.docx"



    Code:
    Sub WegDaMitHansPaulAlan() '    http://www.eileenslounge.com/viewtopic.php?f=26&t=26030#p202223
    Rem Code Part 1) make two temporary Word Files with and without BB Code
    Rem 1) Copy selection to Clipboard
     Selection.Copy
    Rem 2) Make temporary WORD document
    Documents.Add: ActiveDocument.Content.Paste
    ' 2b) Copy of Full Text with BB Code
    Dim FullFilePathAndFullNameBBCode As String
     ActiveDocument.SaveAs Filename:="TempBBCodeCopy1.docx", FileFormat:=wdFormatXMLDocument
     Let FullFilePathAndFullNameBBCode = ActiveDocument.Path & "\" & ActiveDocument.Name
    Rem 3) Replace Code tag pairs with what is in between
     Selection.WholeStory
        With Selection.Find
        .ClearFormatting: .Replacement.ClearFormatting
        .Wrap = wdFindStop
        .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
        End With
    ' 3b) Copy of Colored Text without BB Code Code tags
    Dim FullFilePathAndFullNameNoBBCode As String
     ActiveDocument.SaveAs Filename:="TempNoBBCodeCopy2.docx", FileFormat:=wdFormatXMLDocument
     Let FullFilePathAndFullNameNoBBCode = ActiveDocument.Path & "\" & ActiveDocument.Name
    Rem 4) "Reset the "Find Replace Text Dialogue" "Thing" "
     ActiveDocument.Select
     Selection.WholeStory
        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) Option to close / kill document
     ActiveDocument.Close (wdDoNotSaveChanges)
     'Kill FullFilePathAndFullNameBBCode
     'Kill FullFilePathAndFullNameNoBBCode
    End Sub ' End Code Part 1)
    Google first, like this site:ExcelFox.com "Short Title or Theme of wot youre looking for"
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE:
    Tools for that:
    http://www.excelfox.com/forum/showth...=9821#post9821
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/

Posting Permissions

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