Hello All,
I am using Office 2010 and have found this code which works perfect
But I need the following amendments to the code

1) The code should *read all the files in the Folder* - now it runs on a
single word document
2) It should paste the *All Word table Data under the last available Row on
Sheet1 - currently it overwrites existing data.*

Following is the code which needs to be amended:

Sub ImportTable()
Dim wdDoc As Object
Dim wdTbl As Object
Dim wdFileName As Variant
Dim TableNo As Integer 'table number in Word
Dim cRow As Long 'row index in Excel
Dim cCol As Integer 'column index in Excel
Dim wRow As Long 'row index in Excel


wdFileName = Application.GetOpenFilename("Word files (*.doc),*.doc", , _
"Browse for file containing table to be imported")

If wdFileName = False Then Exit Sub '(user cancelled import file browser)

Set wdDoc = GetObject(wdFileName) 'open Word file
cRow = 0

With wdDoc
    For Each wdTbl In wdDoc.tables
        With wdTbl
        'Test for To in Table Cell 1
        If InStr(wdTbl.Cell(1, 1).Range.Text, "To") Then

            'copy cell contents from Word table cells to Excel cells
            For wRow = 1 To .Rows.Count
                cRow = cRow + 1
                For cCol = 1 To .Columns.Count
                    Cells(cRow, cCol) =
WorksheetFunction.Clean(.Cell(wRow, cCol).Range.Text)
                Next cCol
            Next wRow
        End If
        End With
    cRow = cRow + 1
    Next
End With

Set wdDoc = Nothing
Set wdTbl = Nothing
End Sub

Thanks in advance


Thanks


On Fri, Jun 9, 2017 at 3:24 AM, <excel-macros@googlegroups.com> wrote:

> excel-macros@googlegroups.com
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/excel-macros/topics>
>  Google
> Groups
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview>
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview>
> Today's topic summary
> View all topics
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/excel-macros/topics>
>
>    - GOAL SEEK <#m_-7746555178834149049_group_thread_0> - 2 Updates
>    - Direct Client Req-ServiceNow Developer-Coral Gables FL
>    <#m_-7746555178834149049_group_thread_1> - 1 Update
>    - Need Help: Summary data from sheets in the same workbook
>    <#m_-7746555178834149049_group_thread_2> - 2 Updates
>    - Required break chart in excel
>    <#m_-7746555178834149049_group_thread_3> - 2 Updates
>    - When Excel Save then below message show
>    <#m_-7746555178834149049_group_thread_4> - 1 Update
>
> GOAL SEEK
> <http://groups.google.com/group/excel-macros/t/a9d21230cab2c641?utm_source=digest&utm_medium=email>
> GENIUS <izharra...@gmail.com>: Jun 07 11:46PM -0700
>
> Sir,
>
>
> Please one more favor
> ...more
> <http://groups.google.com/group/excel-macros/msg/7e4af66e79e21?utm_source=digest&utm_medium=email>
> Sandeep Kumar Baranwal <sandeepkumarbaran...@gmail.com>: Jun 09 04:24AM
> +0530
>
> Hi
>
> Use SOLVER. In this case, the Subject to the Constraints :
> $N$2:$N$21=$O$2:$O$21
>
>
> Set Objective : $N$2
>
> To : Value of 7
>
> By Changing Variable Cells : $F$2:$F$21
>
> Subject to the ...more
> <http://groups.google.com/group/excel-macros/msg/37cc82c4cd668?utm_source=digest&utm_medium=email>
> Back to top <#m_-7746555178834149049_digest_top>
> Direct Client Req-ServiceNow Developer-Coral Gables FL
> <http://groups.google.com/group/excel-macros/t/354b72e427944735?utm_source=digest&utm_medium=email>
> Bhanu Pratap <recruitingc2c...@gmail.com>: Jun 08 01:31PM -0400
>
> Please let me know if you have any consultant for below role.
>
> *JOB DESCRIPTION:*
>
> *Job Title:* ServiceNow Developer
>
> *Location:* Coral Gables FL
>
> *Duration:* 6+ Months
>
> *Interview Mode:* ...more
> <http://groups.google.com/group/excel-macros/msg/36b3224c5746e?utm_source=digest&utm_medium=email>
> Back to top <#m_-7746555178834149049_digest_top>
> Need Help: Summary data from sheets in the same workbook
> <http://groups.google.com/group/excel-macros/t/e99c16da23e5b6a4?utm_source=digest&utm_medium=email>
> Mustapha LMIDMANI <lmidmani.musta...@gmail.com>: Jun 08 09:18AM
>
> Hi,
>
> Can somone help on my issue please .
>
>
>
> On 6 June 2017 at 10:50, Mustapha LMIDMANI <lmidmani.musta...@gmail.com>
> wrote:
>
> ...more
> <http://groups.google.com/group/excel-macros/msg/3503bc4bb574f?utm_source=digest&utm_medium=email>
> Kenyatta Freed <kenyattafr...@yahoo.com>: Jun 08 11:13AM
>
> --------------------------------------------
> On Thu, 6/8/17, Mustapha LMIDMANI <lmidmani.musta...@gmail.com> wrote:
>
> Subject: Re: $$Excel-Macros$$ Need Help: Summary data from sheets in the
> same ...more
> <http://groups.google.com/group/excel-macros/msg/3568ab2848572?utm_source=digest&utm_medium=email>
> Back to top <#m_-7746555178834149049_digest_top>
> Required break chart in excel
> <http://groups.google.com/group/excel-macros/t/f69aea00658464ad?utm_source=digest&utm_medium=email>
> amar takale <amartak...@gmail.com>: Jun 08 09:47AM +0530
>
> Hi friends
>
> Good Morning
>
> Any Idea?
>
> ...more
> <http://groups.google.com/group/excel-macros/msg/33fcb75e89da6?utm_source=digest&utm_medium=email>
> Storey Thomas <storeythomas...@yahoo.com>: Jun 08 06:21AM
>
> --------------------------------------------
> On Thu, 6/8/17, amar takale <amartak...@gmail.com> wrote:
>
> Subject: Re: $$Excel-Macros$$ Required break chart in excel ...more
> <http://groups.google.com/group/excel-macros/msg/346cbe4a84c8e?utm_source=digest&utm_medium=email>
> Back to top <#m_-7746555178834149049_digest_top>
> When Excel Save then below message show
> <http://groups.google.com/group/excel-macros/t/c22a0fcb48c38c5a?utm_source=digest&utm_medium=email>
> amar takale <amartak...@gmail.com>: Jun 08 09:47AM +0530
>
> ???
>
> ...more
> <http://groups.google.com/group/excel-macros/msg/33fd0fa159714?utm_source=digest&utm_medium=email>
> Back to top <#m_-7746555178834149049_digest_top>
> You received this digest because you're subscribed to updates for this
> group. You can change your settings on the group membership page
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/excel-macros/join>
> .
> To unsubscribe from this group and stop receiving emails from it send an
> email to excel-macros+unsubscr...@googlegroups.com.
>



-- 

*Rashid Khan*

*Senior Trainer*



*ExecuTrain*

*AmanatSoft*

*Corporate Training*

*Software Development*



PO Box: 26977, Dubai, UAE

Tel: +97143374888, Fax: +97143374889, *Mob: +971(55)7490756 –
+971(50)2323657*

www.executrain.ae | www.executrain.com/dubai | *www.amanatsoft.com*

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to