View Single Post
 
Old 11-13-2019, 03:42 PM
Ethen5155 Ethen5155 is offline Windows 10 Office 2016
Novice
 
Join Date: Nov 2019
Posts: 5
Ethen5155 is on a distinguished road
Angry gather specfic Tables to one file

Hi all,

well i'm in bad situation in dealing with huge number of files for translation in docx files

i'm trying to find a code that can go through defined path folder by prompt window or anything else,



then copy the 4th table as shown below



and gather all of tables to the first file and separate between them by a paragraph mark



i have attached sample files for before and after


and here is code that can copy specific table to a new document but i couldn't make it go through multiple files with the separator and when it copy a table it doesn't copy the format, table and cell sizes well



Quote:
Sub ExtractSpecificTables()
Dim objTable As Table
Dim objDoc As Document
Dim objNewDoc As Document
Dim objRange As Range
Dim strTable As String

strTable = InputBox("Enter the table number: ")
Set objDoc = ActiveDocument
Set objNewDoc = Documents.Add

objDoc.Tables(strTable).Range.Select
Selection.Copy

Set objRange = objNewDoc.Range
objRange.Collapse Direction:=wdCollapseEnd
objRange.PasteSpecial DataType:=wdPasteRTF

End Sub


Many thanks in advance

Cheers

Cross - Posting:gather all Tables to one file
Attached Files
File Type: zip Before.zip (104.1 KB, 9 views)
File Type: zip After.zip (22.3 KB, 10 views)

Last edited by Ethen5155; 11-14-2019 at 05:53 AM.
Reply With Quote