Sablesword
TMF Master
- Joined
- Jun 13, 2001
- Messages
- 785
- Points
- 18
Recently I was asked how I format my stories & how I deal with the fiddly business of arranging proper formatting when I post something here. My answer was that I write using MS Word, and then create a "markup copy" of the finished story. I apply various macros to this copy of the story to mark it up with proper formatting and BB code, and then copy & paste it here.
After creating (and saving!) a "markup copy" of my story, I first apply a macro to replace the tabs used to indent paragraphs with a blank line between paragraphs.
Then, I run a macro to replace all the curly ("smart") quotes with straight quotes. This macro also replaces a couple of other bits of typographical fanciness with the flat-ascii version.
Then, I run a macro to mark all the italic words and phrases with [i][/i] tags.
Then I run a macro to replace all the #'s I use to mark off sections with the tagged version: [center]#[/center]
Finally I save the mark-up copy of the story, and then copy & paste it into a TT post.
And here are the macros. You can copy and paste them into your visual basic editor, invoked from MS Word.
Sub tab2para()
'
' tab2para Macro
' This macro removes the tab mark at the beginning of each
' paragraph and replaces it with an extra paragraph mark.
' This changes the paragraph formatting from indented to
' blank-line-between each paragraph.
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p ^t"
.Replacement.Text = "^p^p "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Sub De_curl()
'
' De_curl Macro
' This macro replaces curly quotes with straight quotes,
' en-dashes with hyphens, and ellipses with three periods
'
With Options
.AutoFormatAsYouTypeReplaceQuotes = False
.AutoFormatReplaceQuotes = False
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = """"
.Replacement.Text = """"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "'"
.Replacement.Text = "'"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "–"
.Replacement.Text = "-"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "…"
.Replacement.Text = "..."
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
'
' This section turns automatic smart quotes back on
' If you normally leave smart quotes off
' Then you need to delete the following
' "With Options...End With"
'
With Options
.AutoFormatAsYouTypeReplaceQuotes = True
.AutoFormatReplaceQuotes = True
End With
End Sub
Sub Italic2tag()
'
' ReplaceItalicsWithTag Macro
'
' Searches through a document and inserts an Tag [I][/I]
' character before and after all text with italic formatting,
' and removes the italic formatting.
' copied from a usenet post by Robert Kerr & modified
' & modified 11/08/2005
Dim boolFoundItalic As Boolean
boolFoundItalic = False
Selection.HomeKey unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Font.Italic = True
' Loop through each instance of italics in the document
Do
' Set the find parameters
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Font.Italic = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
If Selection.Find.Execute Then
boolFoundItalic = True
Else
boolFoundItalic = False
End If
If boolFoundItalic Then
With Selection
.InsertBefore "[I]"
.InsertAfter "[/I]"
.Font.Italic = False
End With
End If
Loop Until boolFoundItalic = False
End Sub
Sub TagSectionMark()
'
' TagSectionMark Macro
' This macro replaces all "#" (which I use as section markers)
' with the tagged version: [center]#[/center]
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.Alignment = wdAlignParagraphLeft
End With
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = "#"
.Replacement.Text = "[center]#[/center]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
After creating (and saving!) a "markup copy" of my story, I first apply a macro to replace the tabs used to indent paragraphs with a blank line between paragraphs.
Then, I run a macro to replace all the curly ("smart") quotes with straight quotes. This macro also replaces a couple of other bits of typographical fanciness with the flat-ascii version.
Then, I run a macro to mark all the italic words and phrases with [i][/i] tags.
Then I run a macro to replace all the #'s I use to mark off sections with the tagged version: [center]#[/center]
Finally I save the mark-up copy of the story, and then copy & paste it into a TT post.
And here are the macros. You can copy and paste them into your visual basic editor, invoked from MS Word.
Sub tab2para()
'
' tab2para Macro
' This macro removes the tab mark at the beginning of each
' paragraph and replaces it with an extra paragraph mark.
' This changes the paragraph formatting from indented to
' blank-line-between each paragraph.
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p ^t"
.Replacement.Text = "^p^p "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Sub De_curl()
'
' De_curl Macro
' This macro replaces curly quotes with straight quotes,
' en-dashes with hyphens, and ellipses with three periods
'
With Options
.AutoFormatAsYouTypeReplaceQuotes = False
.AutoFormatReplaceQuotes = False
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = """"
.Replacement.Text = """"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "'"
.Replacement.Text = "'"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "–"
.Replacement.Text = "-"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "…"
.Replacement.Text = "..."
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
'
' This section turns automatic smart quotes back on
' If you normally leave smart quotes off
' Then you need to delete the following
' "With Options...End With"
'
With Options
.AutoFormatAsYouTypeReplaceQuotes = True
.AutoFormatReplaceQuotes = True
End With
End Sub
Sub Italic2tag()
'
' ReplaceItalicsWithTag Macro
'
' Searches through a document and inserts an Tag [I][/I]
' character before and after all text with italic formatting,
' and removes the italic formatting.
' copied from a usenet post by Robert Kerr & modified
' & modified 11/08/2005
Dim boolFoundItalic As Boolean
boolFoundItalic = False
Selection.HomeKey unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Font.Italic = True
' Loop through each instance of italics in the document
Do
' Set the find parameters
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Font.Italic = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
If Selection.Find.Execute Then
boolFoundItalic = True
Else
boolFoundItalic = False
End If
If boolFoundItalic Then
With Selection
.InsertBefore "[I]"
.InsertAfter "[/I]"
.Font.Italic = False
End With
End If
Loop Until boolFoundItalic = False
End Sub
Sub TagSectionMark()
'
' TagSectionMark Macro
' This macro replaces all "#" (which I use as section markers)
' with the tagged version: [center]#[/center]
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.Alignment = wdAlignParagraphLeft
End With
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = "#"
.Replacement.Text = "[center]#[/center]"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub