Sub CheckAndAdd() ' A VBA macro for Microsoft Word ' The source document has a list of concepts, one to a line ' The macro checks to see if the first concept is listed in the target document ' If it is not then, the concept is added at the end of the target ' However, if the line from the source document is a heading; this heading is added ' instead of a concept ' The macro goes one line per execution ' Extension to any number of lines or the whole source is simple Selection.HomeKey Unit:=wdLine ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="temporarybookmark" Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend If Selection.ParagraphFormat.OutlineLevel = wdOutlineLevelBodyText Then Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend TheText = Selection.Text Switch1 = 0 Else Switch1 = 1 TheText = Selection.Text ParagraphLevel = Selection.ParagraphFormat.OutlineLevel End If Windows("Journey in being-concepts-short-temp.doc").Activate If Switch1 = 0 Then Selection.Find.ClearFormatting With Selection.Find .Text = TheText .Forward = True .Wrap = wdFindAsk End With Selection.Find.Execute Selection.EndKey Unit:=wdStory If Selection.Find.Found = False Then Selection.EndKey Unit:=wdStory Selection.TypeText (TheText) Selection.TypeParagraph End If ElseIf Switch1 = 1 Then Selection.EndKey Unit:=wdStory Selection.TypeText (TheText) Selection.MoveUp Unit:=wdLine, Count:=1 If ParagraphLevel = wdOutlineLevel1 Then Selection.Style = "Heading 1" ElseIf ParagraphLevel = wdOutlineLevel2 Then Selection.Style = "Heading 2" ElseIf ParagraphLevel = wdOutlineLevel3 Then Selection.Style = "Heading 3" ElseIf ParagraphLevel = wdOutlineLevel4 Then Selection.Style = "Heading 4" ElseIf ParagraphLevel = wdOutlineLevel5 Then Selection.Style = "Heading 5" ElseIf ParagraphLevel = wdOutlineLevel6 Then Selection.Style = "Heading 6" ElseIf ParagraphLevel = wdOutlineLevel7 Then Selection.Style = "Heading 7" ElseIf ParagraphLevel = wdOutlineLevel8 Then Selection.Style = "Heading 8" ElseIf ParagraphLevel = wdOutlineLevel9 Then Selection.Style = "Heading 9" End If End If Selection.HomeKey Unit:=wdStory Windows("Journey in being-concepts.doc").Activate Selection.GoTo What:=wdGoToBookmark, Name:="temporarybookmark" Selection.MoveDown Unit:=wdParagraph, Count:=1 End Sub