Results 1 to 10 of 52

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

Threaded View

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

    BB Code Generating and Removing. Preparing Forum Post in Word.

    Sample Codes

    The codes in this Word File, I will probably update from time to time, but the Link will probably stay the same:
    “eileenslounge.docm”
    https://app.box.com/s/mtwz5jil0p5nbymqrb1cgszjuyg94bea
    I actually transfer all my current macros that are to do with using Microsoft Word to prepare a Forum post into the code module “NormalCodesBackUp”.
    They come from where I always start putting my macros which is in some default code module God knows where which I never named or created and is in some File I never named or created called “Normal”.
    The code module is called NewMacros. I do not have much experience with Word VBA, and my first codes were just done by having the macro recorder turned on whilst manually doing what I wanted. After that I modified the codes a bit and they have been available since to anything I do in word.
    NormalMacros.jpg http://imgur.com/TV5YnJ8

    Some codes are very simple, so explaining them all may be a bit tedious. I will just go through a few examples. ( I tend to explain a lot in the '_- Green 'comments going off to the right. )

    Simple codes for putting single BB Code Code tags pairs in
    I mostly got these from a macro recording done while I did what I wanted manually. Then I had some help here http://www.eileenslounge.com/viewtopic.php?f=26&t=25185 http://www.eileenslounge.com/viewtopic.php?f=44&t=26076 to refine them a bit
    One further very useful thing I picked up here http://www.eileenslounge.com/viewtop...=25188#p195442 is that you have available an extended range of short cut keys which you can use to trigger off a macro.

    The start point of most of my codes are to select the text to which a code pair should be added
    So say in my Word File I want to change the text,
    'comments
    to look in my word document as
    [color=green]'comments[/color]
    This will return me in a final posted Reply in a Thread the following:
    'comments
    ( Note: I am putting the format, ( here coloring green ) , into the Word document of the same formatting that the BB Code Code tag pair will produce in the final forum post )

    So I select that text and use in thes case the short cut keys of first
    Ctrl+Shift+g
    Followed by ( the extended option )
    1

    This is the code that does this, ( and there may be lots of better ways to do it):

    Code:
    Sub Makro10BBGreen()   '  Ctrl+Shift+G,1  https://eileenslounge.com/viewtopic.php?f=26&t=25185#p195286
    '     Let Selection.Font.Color = 5287936 'Green
    '    Dim rng As Range: Set rng = Selection.Range
    '    Dim Txt As String
    '     Let Txt = rng.Text
    '     'Let Txt = "" & Txt & " " 'Added a " " space on the end, so that at end of selection is where I want to be or..
    '     Let Txt = "" & Txt & ""
    '     Let rng.Text = Txt
    '     rng.Select ' Select so that I can ...
    '     Selection.Collapse Direction:=wdCollapseEnd ' ... "unselect" with an option that takes me to the end of the text
    '     Selection.Font.Color = wdColorAutomatic ' Put text color back to automatic
    '    Set rng = Nothing
    'Or
        With Selection
         .Font.Color = 5287936
         .Text = "" & .Text & ""
         .Collapse Direction:=wdCollapseEnd
         .Font.Color = wdColorAutomatic
        End With
    End Sub

    This shows the short cut combination, which is ExPlained in a bit more detail here: http://www.eileenslounge.com/viewtop...=25188#p195293
    http://wordribbon.tips.net/T008058_A...rtcut_Key.html

    _1 Display the Word Options dialog box. (In Word 2007 click the Office button and then click Word Options. In Word 2010 and Word 2013 display the File tab of the ribbon and then click Options.)
    _2 At the left side of the dialog box click Customize (Word 2007) or Customize Ribbon (Word 2010 and Word 2013).
    _3 Near the bottom of the dialog box click the Customize button. Word displays the Customize Keyboard dialog box.
    _4 Scroll through the Categories list and select the Macros category. The list at the right side of the dialog box changes to show the currently available macros.
    _5 In the Macros list, select the macro you want assigned to the shortcut key.
    _6 With the insertion point in the Press New Shortcut Key box, press the shortcut key you want to use. For instance, if you want to use Ctrl+Alt+J, press that.
    _7 Just below the Current Keys box you can see whether the shortcut key is already assigned to a different function.
    _8 Click on Assign.
    ( _ I think 7 should read _7 Just to the Left of the Keys…… )

    Note the extended options _..
    Green1ShortCut.JPG http://imgur.com/zpOZljD
    _..you write in Ctrl+Shift+G and then 1. You do not type in a comer , that is done for you. You also do not type in a comer when you use the keys.


    Codes for white Space Tricks.
    In the first post was discussed the problem with Forum Editors typically “eating” spaces in the posted Reply. I wrote a number of codes, developed here:
    http://www.eileenslounge.com/viewtopic.php?f=26&t=22603 http://www.excelforum.com/the-water-...ml#post4329068
    to do the “white space trick”
    They are discussed in detail in those referenced threads.

    BB Code Table Generator ( Spreadsheet screenshot copyable to a Forum Post )
    Using Excel 2007 32 bit
    Row\Col
    E
    F
    18
    This is discussed in
    19
    detail from the start of this Thread: http://www.excelforum.com/developmen...ly-needed.html
    20
    and also in more Threads then I can remember !
    Worksheet: Tabelle3


    '_- Here just a few Posts
    http://www.excelfox.com/forum/showth...=9821#post9821
    http://www.excelfox.com/forum/showth...-BB-Code/page3
    http://www.excelforum.com/developmen...ml#post4513357
    http://www.excelforum.com/suggestion...ml#post4355361
    http://www.excelforum.com/the-water-...ml#post4355240
    http://www.excelforum.com/excel-prog...ml#post4399581
    http://www.excelforum.com/the-water-...ml#post4109080

    Here is a File where I collected lots of such Tools, all as stand codes rather than Add-ins.
    Included are also versions of Rory’s Tool as a simple code.
    https://app.box.com/s/zhz7awdag4nl1zs6564s9zzcwp50e4w9
    ( Note: There is a separate Tool for Eileen’s lounge. In the file is a version for Excel. It is derived from Tools from Hans ( Excel and Word ) http://www.eileenslounge.com/viewtopic.php?f=50&t=1421 http://www.eileenslounge.com/viewtopic.php?f=50&t=2121 )



    Codes to remove BB Code in text:
    I may discuss these in a bit more detail, just to get the documentation down some where, as I only did it all recently.
    Such codes may be of limited use. I needed to do it after a Forum Hic cup wiped out a massive amount of my threads , which I only have as a back up in text including BB Code.

    I have
    _ a long complicated code, that I did myself, that just works on a simple monochrome text string of the entire text.
    and
    _ a more sensible code which I got some help with. This will take out the BB Code Code tags but leave the text in the Format it has in the Final Thread. That is to say, the form given by the code looks in Word just as it did in the final form in the Forum post. ( Note, however, that this is only possible as the codes for putting single BB Code Code tags pairs which I used also put the corresponding format into the text in a Word document in the first place )
    Last edited by DocAElstein; 12-21-2017 at 03:45 PM.
    ….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
  •