IF YOU ARE INTERESTED, HERE IS THE VBA SOURCE FILE FOR THE SOF2SHOUT MACRO: Sub SOF2SHOUT() ' 2/17/2007 ' SOF2SHOUT Macro ' Converts Songs of Fellowship (SOF) formatted .rtf file to ShoutSinger Format text files ' It can process multiple songs per input file (even over 1000 songs are OK, approx 2 seconds per song to process) ' It searches for page breaks and/or song numbers to distinguish between songs ' Creates a ShoutSinger formatted file for EACH song that is processed - in the same folder as the input file ' Note - SOF format does not designate verse, chorus, endings, etc - so this program simply assumes any text following a blank line is a new verse ' Note - SOF format designates the song title by ALL CAPITAL letters in the first line of the song ' Song Title, verse, playorder changes can be made in ShoutSinger after the songs are imported ' This macro creates a copy of the input file, with "temp1" appended to the file name and then processes through that file. ' This macro does not delete any files, including the temp1 file. ' ' Disclaimer - this is unsupported freeware, the user agrees to indemnify and hold harmless the author(s) of this program against any claim, loss or damages. ' R. Noar ' ' To God be the Glory! ' Copyright Message Dim Msg, Style, Title, Response, MyString Msg = "By Clicking 'Yes', I agree to accept sole liability for the use of this program, agree to abide by all copyright laws, and agree to indemnify and hold harmless the author(s) of this program against any claim, loss or damages." Style = vbYesNo ' Define buttons. Title = "Disclaimer" ' Define title. Response = MsgBox(Msg, Style, Title) If Response = vbNo Then GoTo ExitSub ' Create a working copy tempDocName = ActiveDocument.FullName tempDocName = tempDocName & "temp1" ActiveDocument.SaveAs FileName:=tempDocName ' Setup page format With ActiveDocument.PageSetup .LineNumbering.Active = False .Orientation = wdOrientPortrait .TopMargin = InchesToPoints(0.5) .BottomMargin = InchesToPoints(0.5) .LeftMargin = InchesToPoints(0.5) .RightMargin = InchesToPoints(0.5) .Gutter = InchesToPoints(0) .HeaderDistance = InchesToPoints(0.5) .FooterDistance = InchesToPoints(0.5) .PageWidth = InchesToPoints(8.5) .PageHeight = InchesToPoints(11) End With ' Add page break at end of document Selection.EndKey Unit:=wdStory Selection.InsertBreak Type:=wdPageBreak ' Entire Document - Remove extra text Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "A Songs of Fellowship Worship Resource" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Entire Document - Remove extra text Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "CCL Licence number:" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Entire Document - Replace paragraph breaks with line breaks Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^p" .Replacement.Text = "^l" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Eliminate Multiple Blank Lines Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^l^l^l" .Replacement.Text = "^l^l" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Entire Document - Remove any blank lines before song Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^m^l@" .Replacement.Text = "^m" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Entire Document - Leading Parens also start separate Verse Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "[!^l][^l](" .Replacement.Text = "^l^l(" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Entire Document - Remove extra blank lines after the last verse Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^l@^m" .Replacement.Text = "^m" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Entire Document - Remove "Copyright", will be added back in later Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "Copyright " .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Pre-Processing of file done - now work on each song.... '------------------------------------------------------------------------------------------------------------- '-------------- Repeat the following for each song in the input file ----------------------------------------- '------------------------------------------------------------------------------------------------------------- DoSong: ' Find Song Title ' Go To Top Selection.HomeKey Unit:=wdStory ' Find the start of ALL CAPS section Selection.Find.ClearFormatting With Selection.Find .Text = "^l[A-Z]" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = True .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With If Selection.Find.Execute = False Then GoTo AllDone End If Selection.MoveRight Unit:=wdCharacter, Count:=1 Selection.HomeKey Unit:=wdLine Selection.TypeText Text:=Chr(11) ' Extra line breaks before first verse of song Selection.TypeText Text:=Chr(11) Selection.MoveRight Unit:=wdCharacter, Count:=1 Selection.EndKey Unit:=wdLine ' Find the end of ALL CAPS section Selection.EndKey Unit:=wdLine Selection.Find.ClearFormatting With Selection.Find .Text = "[A-Z][A-Z]" .Replacement.Text = "" .Forward = False .Wrap = wdFindContinue .Format = False .MatchCase = True .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Selection.MoveRight Unit:=wdCharacter, Count:=1 Selection.HomeKey Unit:=wdLine, Extend:=wdExtend SongTitle = Selection.Text ' MsgBox ("Song Title: " & SongTitle) 'For Debugging ' Go To Top Selection.HomeKey Unit:=wdStory ' Get song number - not all song numbers at the beginning, so do the following: Selection.Find.ClearFormatting With Selection.Find .Text = "[0-9]@^t" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With If Selection.Find.Execute = False Then GoTo SkipNum Selection.Cut ' Go To Top and paste the song number at the beginning Selection.HomeKey Unit:=wdStory Selection.Paste SkipNum: ' Go To Top Selection.HomeKey Unit:=wdStory ' Make sure song is split by page break Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "[!^m]^l^l([0-9])" .Replacement.Text = "^m\1" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceOne ' Go To Top Selection.HomeKey Unit:=wdStory ' Author header Selection.Find.ClearFormatting With Selection.Find .Text = "[!0-9]" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute ' Selection.MoveRight Unit:=wdCharacter, Count:=1 Selection.TypeText Text:=Chr(11) Selection.TypeText Text:="Author: " Selection.EndKey Unit:=wdLine ' Copyright header Selection.MoveRight Unit:=wdCharacter, Count:=1 Selection.TypeText Text:="Copyright: " ' Select Copyright area Selection.Extend Selection.Find.ClearFormatting With Selection.Find .Text = "^l^l" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute ' This Song only - Remove line wraps on multiple copyright lines ' !!! Note - Use wdFindStop so that replacements are only done in selected area Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^l^t" .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 ' Go To Top Selection.HomeKey Unit:=wdStory ' Put the Title header at the top Selection.TypeText Text:="Title: " & SongTitle & " " ' Go To Top Selection.HomeKey Unit:=wdStory ' Go down 3 lines and put in CCLI header Selection.Find.ClearFormatting With Selection.Find .Text = "^l*^l*^l" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Selection.EndKey Unit:=wdLine, Extend:=wdMove Selection.TypeText Text:=Chr(11) Selection.TypeText Text:="CCLI: " Selection.TypeText Text:=Chr(11) ' Put in Song ID header Selection.TypeText Text:="Song ID: a-" & Left(SongTitle, 8) & Right(SongTitle, 8) ' Clean up Song ID header ' Skip over the "a-" part of the Song ID Selection.HomeKey Unit:=wdLine Selection.MoveRight Unit:=wdCharacter, Count:=11 Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend ' Remove spaces & other unwanted stuff from Song ID field Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find ' Note - anything that is not a number or alphabet char is removed .Text = "[!a-z,A-Z,0-9]" .Replacement.Text = "" .Forward = True ' !!! Note - Use wdFindStop so that replacements are only done in selected area .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Remove any commas from Song ID field Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "," .Replacement.Text = "" .Forward = True ' !!! Note - Use wdFindStop so that replacements are only done in selected area .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Insert line break Selection.EndKey Unit:=wdLine, Extend:=wdMove Selection.TypeText Text:=Chr(11) ' Put in Notes header Selection.HomeKey Unit:=wdLine Selection.TypeText Text:="Notes: Song format converted by SOF2Shout" Selection.TypeText Text:=Chr(11) ' Put in Playorder header Selection.HomeKey Unit:=wdLine Selection.TypeText Text:="PlayOrder: " ' Go To Top Selection.HomeKey Unit:=wdStory ' Eliminate Multiple Blank Lines in Current Song Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^l^l^l" .Replacement.Text = "^l^l" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Go To Top Selection.HomeKey Unit:=wdStory ' Find the first verse - initialize cursor for verse loop below Selection.Find.ClearFormatting With Selection.Find .Text = "^l^l[A-Z]" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = True .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Selection.MoveLeft Unit:=wdCharacter, Count:=1 ' Current song only - Find verses and put in Verse: tags Dim VerseCnt VerseCnt = 0 ' Initialize variable. '---------Do the following for each verse in the current song ------------------------ ChkVerse: ' Select page Selection.Extend Selection.Find.ClearFormatting With Selection.Find .Text = "^m" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute ' Current Song only - Put in Verse : tags ' !!! Note - Use wdFindStop so that replacements are only done in selected area Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^l^l" .Replacement.Text = "^l^lVerse:^l" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With If Selection.Find.Execute(Replace:=wdReplaceOne) Then VerseCnt = VerseCnt + 1 Selection.EndKey Unit:=wdLine, Extend:=wdMove GoTo ChkVerse Else End If '------------------ End of Verse Loop ------------------------------------------- ' GoTo Top Selection.HomeKey Unit:=wdStory ' Eliminate tabs for this song ' Select page Selection.Extend Selection.Find.ClearFormatting With Selection.Find .Text = "^m" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute ' Eliminate tabs ' !!! Note - Use wdFindStop so that replacements are only done in selected area Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^t" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Eliminate Multiple Blank Lines in Current Song ' !!! Note - Use wdFindStop so that replacements are only done in selected area Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^l^l^l" .Replacement.Text = "^l^l" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Build Playorder info ' GoTo Top Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting With Selection.Find .Text = "Playorder: " .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.EndKey Unit:=wdLine, Extend:=wdMove Select Case VerseCnt Case 1 Selection.TypeText Text:="v1" Case 2 Selection.TypeText Text:="v1,v2" Case 3 Selection.TypeText Text:="v1,v2,v3" Case 4 Selection.TypeText Text:="v1,v2,v3,v4" Case 5 Selection.TypeText Text:="v1,v2,v3,v4,v5" Case 6 Selection.TypeText Text:="v1,v2,v3,v4,v5,v6" Case 7 Selection.TypeText Text:="v1,v2,v3,v4,v5,v6,v7" Case 8 Selection.TypeText Text:="v1,v2,v3,v4,v5,v6,v7,v8" Case 9 Selection.TypeText Text:="v1,v2,v3,v4,v5,v6,v7,v8,v9" Case 10 Selection.TypeText Text:="v1,v2,v3,v4,v5,v6,v7,v8,v9,v10" Case 11 Selection.TypeText Text:="v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11" Case 12 Selection.TypeText Text:="v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12" Case Else Selection.TypeText Text:="v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16" End Select ' Go to the top Selection.HomeKey Unit:=wdStory ' Select page Selection.Extend Selection.Find.ClearFormatting With Selection.Find .Text = "^m" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute ' Cut out current Song Selection.Cut ' Save temp document ActiveDocument.Save ' Generate song file name using current path myDocname = ActiveDocument.Path & "\" & SongTitle & "_ShoutSinger_Format.txt" ' Open new document for Current Song Documents.Add ' Go to the top Selection.HomeKey Unit:=wdStory Selection.Paste ' Save the song as a text file, appending "ShoutSinger Format" ActiveDocument.SaveAs FileName:=myDocname, FileFormat:=wdFormatText ActiveDocument.ActiveWindow.Close ' Close Current song & Switch to working copy again ' Process the next song GoTo DoSong AllDone: MsgBox ("ALL DONE!") ActiveDocument.ActiveWindow.Close ExitSub: End Sub