Results 1 to 12 of 12

Thread: Copy Bookmarked Text and 'Paste' into Bookmarks in New Document

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    May 2015
    Posts
    44
    Location

    Copy Bookmarked Text and 'Paste' into Bookmarks in New Document

    Hi everyone,

    I want to select bookmarked text from my source document and place it into bookmarks in my target document.

    So far I have considered (code below):

    1. Using a 'Go To' to find the source bookmark
    2. Selecting and Copying
    3. Opening Target Document
    4. Using a 'Go To' tot find the target bookmark
    5. Pasting

    However this is not ideal as I need to do this with over 30+ bookmarks and i'm not convinced is anywhere near the most efficient/correct way to do this.

    Any ideas?

     Private Sub GT()
    Dim oSource As Document
    Dim r As Range
        Dim oTarget As Document
        Set oSource = ActiveDocument
        Selection.GoTo What:=wdGoToBookmark, name:="wholename"
    Selection.Copy
         'Set oTarget = Documents.Add("C:\Path\Templatename.dotx")
        Set oTarget = Documents.Open("C:\Users\herriale\Desktop\New folder\Phase 2\Template (MY.G.PBR) 31.3.15.dotm")
       Selection.GoTo What:=wdGoToBookmark, name:="PlayerName"
       Selection.PasteAndFormat (wdFormatPlainText)
     End Sub
    Last edited by Aussiebear; 09-04-2024 at 11:07 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •