Consulting

Results 1 to 6 of 6

Thread: Copy Text from Bookmark in SourceDoc to use as Document Variable in NewDoc

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Newbie
    Joined
    Feb 2022
    Posts
    3
    Location
    Not sure why it posted like that, code I tried should be:

    Private Sub Document_New()
        Dim oSourceDoc As Document
        Dim oRng As Range
        Set oSourceDoc = Documents.Open("SourceDoc")
        oRng.Text = oSourceDoc.Bookmarks("bookmark").Range.Text
        Set oVars = ActiveDocument.Variables
        oVars("doc_variable").Value = "test"
        Set oVars = Nothing
    End Sub
    Last edited by Aussiebear; 03-24-2025 at 05:35 AM.

Posting Permissions

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