Can you please send the word document which provoked the error (the one
which is opened) ? apparently, there are some merged cells in it.

 

Regards.

 

Daniel

 

De : excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] De
la part de Shrinivas Shevde
Envoyé : mardi 16 août 2011 10:46
À : excel-macros@googlegroups.com
Objet : Re: $$Excel-Macros$$ From Word to Excel

 

Dear Daniel

Very very thanks for kind help 

There is some problem at following line


For j = 3 To myTable.Columns(i).Cells.Count 

 

Run Time ERROR 5992

Can not access indivsual columns in this collection because the table has
mixed cell width

Please Help

 

Shrinivas

 

 

On Sat, Aug 13, 2011 at 4:10 PM, Daniel <dcolarde...@free.fr> wrote:

Test the below macro :

 

Sub WordToExcel()

    Dim strFolder As String, F As Object, strRootFolder As String

    Dim FSO As Object, SF As Object, WordApp As Object

    Dim WordDoc As Object, Ctr As Long, strFile As String, myTable As Object

    Application.ScreenUpdating = False

    Set WordApp = CreateObject("Word.application")

    WordApp.Visible = True

    strRootFolder =
"C:\Users\Daniel\Documents\Donnees\Daniel\mpfe\Shrinivas"

    Set FSO = CreateObject("Scripting.FileSystemObject")

    For Each F In FSO.GetFolder(strRootFolder).SubFolders

        For Each SF In F.SubFolders

            strFile = Dir(SF.Path & "\*.doc*")

            Do While strFile <> ""

                Ctr = Ctr + 2

                Set WordDoc = WordApp.Documents.Open(SF.Path & "\" &
strFile)

                Set myTable = WordDoc.Tables(1)

                For i = 4 To myTable.Columns.Count

                    For j = 1 To myTable.Columns(i).Cells.Count

                        ActiveSheet.Cells(Ctr + j, i - 3) =
myTable.Columns(i).Cells(j)

                    Next j

                Next i

                Ctr = Ctr + myTable.Rows.Count + 2

                WordDoc.Close False

                strFile = Dir

    Loop

        Next SF

    Next F

    Application.ScreenUpdating = True

    WordApp.Quit

    Set WordApp = Nothing

    Set FSO = Nothing

End Sub

 

HTH

Daniel

 

De : excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] De
la part de Shrinivas Shevde
Envoyé : vendredi 12 août 2011 07:27
À : excel-macros@googlegroups.com
Objet : $$Excel-Macros$$ From Word to Excel

 

Dear All

I required help from all of u

Read the Problem

I have a folder  Let Folder name is "AA"

In this folder I have more than 200 folder let us name "B,C D,CD,CF
,.......more than 200"

In each of this folder I have 8 folder which is having comman name Consider
"X,Y,Z ...

In folder Z there are Word file(may be one or many not more than 6) which
contain Table 

I want a macro which can copy paste this tables in the Excel work sheet and
the name of the folder of the second level

Example

1st level -Folder AA

2 nd Level Folder - CD

Third Level Folder Z (Sample Word file attached)

I dont want first 3 column to copy,All the column after 3rd column should
get copy in Attached file 3 column will get coopied.

 

If some one is ready to help then it will be great help for me or I will
required at least 1 month.


Thanks in advanced 
-- 
Shrini

-- 
----------------------------------------------------------------------------
------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
<http://www.excel-macros.blogspot.com/> 
4. Learn VBA Macros at http://www.quickvba.blogspot.com
<http://www.quickvba.blogspot.com/> 
5. Excel Tips and Tricks at  <http://exceldailytip.blogspot.com/>
http://exceldailytip.blogspot.com

To post to this group, send email to  <mailto:excel-macros@googlegroups.com>
excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
 <http://www.facebook.com/discussexcel> http://www.facebook.com/discussexcel

-- 
----------------------------------------------------------------------------
------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
<http://www.excel-macros.blogspot.com/> 
4. Learn VBA Macros at http://www.quickvba.blogspot.com
<http://www.quickvba.blogspot.com/> 
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
<http://exceldailytip.blogspot.com/> 

To post to this group, send email to excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel




-- 
Shrini

-- 
----------------------------------------------------------------------------
------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at  <http://exceldailytip.blogspot.com>
http://exceldailytip.blogspot.com

To post to this group, send email to  <mailto:excel-macros@googlegroups.com>
excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
 <http://www.facebook.com/discussexcel> http://www.facebook.com/discussexcel

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to