Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Pasting Excel Table in Word at Bookmark (https://www.askmehelpdesk.com/showthread.php?t=604616)

  • Oct 17, 2011, 12:03 PM
    hock8889
    Pasting Excel Table in Word at Bookmark
    The code below keeps pasting the range cells on the next page, after the bookmark called input.


    Xlobj.Sheets("Input").Select
    Range("A11:B30").Select
    Selection.Copy
    wdObj.ActiveDocument.Bookmarks("inputs").Range.go to.Select
    wdObj.Selection.PasteSpecial Link:=False, DataType:=wdPasteEnhancedMetafile, _
    Placement:=wdInLine, DisplayAsIcon:=False
  • Oct 17, 2011, 01:26 PM
    JBeaucaire
    Like so:

    Code:

    Option Explicit

    Sub test()
    ' Set a reference to Microsoft Word ?? Object Library
    Dim WDApp As Word.Application
    Dim WDDoc As Word.Document

    Set WDApp = GetObject(, "Word.Application")
    Set WDDoc = WDApp.ActiveDocument

        Sheets("Inputs").Range("A11:B30").Copy
        WDDoc.Bookmarks.Item("Inputs").Range.Paste

    Set WDApp = Nothing
    Set WDDoc = Nothing
    End Sub


  • All times are GMT -7. The time now is 02:28 PM.