Thanks for that, Paul. Now, if I want to insert a couple more bookmark ranges into the same doc, can I just repeat a section of that code and just change the bookmark? My attempt is below, just repeating the "With" section using another bookmark called "int" (thanks for the tip on code tags):
Code:
Sub Import_Bookmarked_Text()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDocSrc As Document, wdDocTgt As Document
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
Set wdDocTgt = ActiveDocument
While strFile <> ""
If strFolder & "\" & strFile <> wdDocTgt.FullName Then
Set wdDocSrc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDocSrc
If .Bookmarks.Exists("pmo") Then
wdDocTgt.Range.InsertAfter vbCr
wdDocTgt.Range.Characters.Last.FormattedText = .Bookmarks("pmo").Range.FormattedText
.Close SaveChanges:=False
End With
With wdDocSrc
If .Bookmarks.Exists("int") Then
wdDocTgt.Range.InsertAfter vbCr
wdDocTgt.Range.Characters.Last.FormattedText = .Bookmarks("int").Range.FormattedText
.Close SaveChanges:=False
End With
strFile = Dir()
Wend
Set wdDocSrc = Nothing: Set wdDocTgt = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function