Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton2_Click()
- ' Copy table from source document and add to table in target document
- Dim oTarDoc As Document, oSourceDoc As Document
- Dim oTable As Table
- Dim oNewRow As Row
- Set oSourceDoc = Documents.Open("H:Test DocumentsTables.docx")
- Set oTarDoc = Documents.Open("H:Test DocumentsProduct.docm")
- Application.ScreenUpdating = False
- oTarDoc.Activate
- Set oTable = oTarDoc.Tables(2)
- Set oNewRow = oTable.Rows(oTable.Rows.Count - 3)
- oSourceDoc.Activate
- Selection.GoTo What:=wdGoToBookmark, Name:="A" & InputBox("119f, 979, 981a...", "Enter Number and Letter as Shown")
- With oSourceDoc.Bookmarks
- .DefaultSorting = wdSortByName
- .ShowHidden = False
- End With
- Selection.Tables(1).Select
- Selection.Copy
- oTarDoc.Activate
- oNewRow.Select
- Selection.Paste
- Application.ScreenUpdating = True End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement