All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: MSWord to BBC
View Likes PostPosted: Wed Dec 09, 2015 6:17 pm 

Rum innate.

User avatar

Joined: Sun Oct 04, 2015 11:05 pm
Posts: 204
Medals: 2
December 2015 (1) Gif Hunt Participant! (1)
Blog: View Blog (4)

Offline
Do you compose in MSWord first before pasting on here? I created a macro that converts italics, bolds, underlines, strikeouts, and hiddens, as well as the basic default colours (MSWord 2010) to BBCodes.

To save: Open Word. Press Alt+F11. Scroll to the very end. Paste the Code below. Save.
To run: Press Alt+F8. Select "WordtoBBC" and click "Run" or press Enter.

Your beautifully composed post is now in BBCodes format, ready to be pasted onto this site.

Update 20151215: Added indent, quote, center, justify, right; doubled hard returns; cleaned up loose ends.


WordtoBBC | +
Code:
Sub WordtoBBC()
Sub WordtoBBC()
'
' WordtoBBC Macro by Sentience
' Basic conversion from Word to BBC.

Dim IndentValue As Variable

    Selection.Find.Replacement.ClearFormatting
    With Selection.Find.Replacement.Font
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .Color = wdColorAutomatic
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 192
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#8B0000]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = wdColorRed
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#FF0000]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 49407
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#FFA500]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = wdColorYellow
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#FFFF00]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 5296274
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#3FFF00]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 5287936
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#008000]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 15773696
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#00FFFF]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 12611584
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#0000FF]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 6299648
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#000080]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = 10498160
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#800080]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
   
    Selection.Find.Font.Color = -603914241
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#FFFFFF]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = -603946753
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[color=#808080]^&[/color]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
   
    Selection.Find.Font.Italic = True
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[i]^&[/i]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Bold = True
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[b]^&[/b]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Underline = wdUnderlineSingle
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[u]^&[/u]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    With Selection.Find.Font
        .StrikeThrough = True
        .DoubleStrikeThrough = False
    End With
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[s]^&[/s]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Font.Hidden = True
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[spoiler]^&[/spoiler]^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    With Selection.Find.ParagraphFormat
        .LeftIndent = InchesToPoints(0.5) ' Change this value to your default indent
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .CharacterUnitLeftIndent = 0
        .MirrorIndents = False
    End With
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[indent]^&[/indent]^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Style = ActiveDocument.Styles("Quote")
   
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[quote]^&[/quote]^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    With Selection.Find.ParagraphFormat
         .Alignment = wdAlignParagraphCenter
    End With
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[center]^&[/center]^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    With Selection.Find.ParagraphFormat
        .Alignment = wdAlignParagraphRight
    End With
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[right]^&[/right]^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
   
    Selection.Find.ClearFormatting
    With Selection.Find.ParagraphFormat
        .Alignment = wdAlignParagraphJustify
    End With
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = "[justify]^&[/justify]^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
   
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^p[/"
        .Replacement.Text = "[/"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^p"
        .Replacement.Text = "^p^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub


Last edited by Sentience on Mon Apr 04, 2016 11:52 pm, edited 2 times in total.

Share on FacebookShare on TwitterShare on RedditShare on VKShare on TumblrShare on Google+Share on MySpace
Top
 Profile  
Reply with quote  
 Post subject: Re: MSWord to BBC
PostPosted: Thu Dec 10, 2015 2:15 pm 

PLaying SQUAD with TASQ

User avatar

Joined: Sat Dec 28, 2013 11:42 pm
Posts: 6710
Location: Captain, Infantry (Retired)
Medals: 6
Longest RP (1) 1st Year (1)
2nd Year (1) Most Helpful Member (1)
Blog: View Blog (8)

Offline
Thanks Sentience. I've always simply typed the code into the text.

_________________
I am playing no game. I am writing a story that maybe a few of you will enjoy.
I am in Eastern Standard Time zone (GMT -5)
ImageImage
ImageImage
Image

My Characters
My Writing Styles
Galileo Corporation
Modern Wargaming Rules
Bakushima; Fantasy Feudal Japan

Best Days for RPing
Fri - Sun

Attitude | +
"The longer I live, the more I realize the impact of attitude on life. Attitude to me is more important than facts. It is more important than the past, than education, than money, than circumstances, than failures, than success, than what other people think or say or do. It is more important than appearance, gift, or skill. It will make or break a company...a church...a home. The remarkable thing is we have a choice every day regarding the attitude we will embrace for that day. We cannot change our past...we cannot change the fact that people will act in a certain way. We cannot change the inevitable. The only thing we can do is play on the string we have, and that is our attitude. I am convinced that life is 10 percent what happens to me and 90 percent how I react to it. And so it is with you... we are in charge of our attitudes. "
~ Charles Swindoll


Share on FacebookShare on TwitterShare on RedditShare on VKShare on TumblrShare on Google+Share on MySpace
Top
 Profile  
Reply with quote  
 Post subject: Re: MSWord to BBC
View Likes PostPosted: Tue Dec 15, 2015 10:58 pm 

Rum innate.

User avatar

Joined: Sun Oct 04, 2015 11:05 pm
Posts: 204
Medals: 2
December 2015 (1) Gif Hunt Participant! (1)
Blog: View Blog (4)

Offline
@Gunther, no problemo. Easier to format, edit, write in Word. Plus, if you get disc'd in the middle of composing, your work is not interrupted, and you have backup/autosave. I find it easier to save mid-work, come back to it later, with a busy schedule and all.

Update: I added indent, quote, center, justify, right; doubled hard returns; cleaned up loose ends.


Share on FacebookShare on TwitterShare on RedditShare on VKShare on TumblrShare on Google+Share on MySpace
Top
 Profile  
Reply with quote  
 Post subject: Re: MSWord to BBC
PostPosted: Wed Dec 16, 2015 3:02 pm 

...looking for some new RP's.

User avatar

Joined: Sun Nov 29, 2015 10:35 am
Posts: 406
Medals: 2
1st Year (1) 2nd Year (1)
Blog: View Blog (1)

Offline
Would that word..erm work for open office as well?

_________________
Best method to kill: | +
Actually, at one point during the month, a group of a dozen or so Cultivators belonging to a different local power group showed up. They desired to slay Meng Hao and take his medicinal pills by force. A single cold snort echoed out from within the Immortal’s cave, causing Heaven and Earth to shake, and instantly killing half of the group.(from ISSTH)

How to beat a Machine gun with a Laser sword. | +
Image
(sig made by Eferhilda)

MtG | +
ImageImage

Nodiatis | +
Image



Share on FacebookShare on TwitterShare on RedditShare on VKShare on TumblrShare on Google+Share on MySpace
Top
 Profile  
Reply with quote  
 Post subject: Re: MSWord to BBC
View Likes PostPosted: Wed Dec 16, 2015 3:38 pm 

Rum innate.

User avatar

Joined: Sun Oct 04, 2015 11:05 pm
Posts: 204
Medals: 2
December 2015 (1) Gif Hunt Participant! (1)
Blog: View Blog (4)

Offline
@Ari Looks like you can DL the Open Office extension here: http://extensions.openoffice.org/en/project/alternative-dialog-find-replace-writer-altsearch

Check out the screenshots here on how to use the extension to convert to BBC: https://www.fimfiction.net/blog/378815/odt-files-libreoffice-and-bbcode-a-simple-solution.


Share on FacebookShare on TwitterShare on RedditShare on VKShare on TumblrShare on Google+Share on MySpace
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 41 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB ® Forum Software © phpBB Group; All Material is the Express Property of Creative Freedom RPG and Its Members | DVGFX2 by: Matt

Protected by Copyscape Duplicate Content Penalty Protection