View Single Post
 
Old 06-02-2016, 11:14 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For that, you could use a macro like:
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
  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
PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote