Eckard
--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html
My idea was to open a word document from excel (how?), extract the table
objects from the document structure (again, how?) and then populate an excel
sheet with the columns and rows of these tables. I'm not a makro expert. If
someone could give me a hint...
Thanks
Eckard
"Debra Dalgleish" <d...@contexturesXSPAM.com> schrieb im Newsbeitrag
news:4018391B...@contexturesXSPAM.com...
In fact, to me, this looks like a reasonable candidate for
cross-posting--including both an excel newsgroup and a word newsgroup in the
headers and sending once.
--
Dave Peterson
ec3...@msn.com
Thanks
Eckard
' ------------------------------
Sub ImportDoc()
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim wdTable As Word.Table
Dim wdRow As Word.Row
Dim wdCell As Word.Cell
Dim nRow, nCol, nTab
Dim bHeader As Boolean
Set wdApp = New Word.Application
Set wdDoc =
wdApp.Documents.Open(FileName:="K:\Projekte\SironWeb\TDI-Integration\SironWe
b Integration TDI.doc")
wdApp.Visible = True
'Call or insert your table copying code here
Range("A1:E999").Clear
nTab = 1
nRow = 1
For Each wdTable In wdDoc.tables
nTab = nTab + 1
bHeader = True
For Each wdRow In wdTable.rows
nCol = 1
nRow = nRow + 1
For Each wdCell In wdRow.cells
nCol = nCol + 1
With ActiveSheet.cells(nRow, nCol)
.Select
.Font.Bold = bHeader
If bHeader Then
.HorizontalAlignment = xlCenter
Else
.HorizontalAlignment = xlHAlignGeneral
End If
End With
wdCell.Range.Copy
ActiveSheet.Paste
Next
bHeader = False
Next
nRow = nRow + 1
Next
'wdApp.ActiveDocument.Save
'wdApp.ActiveDocument.Close
wdApp.Quit
Set wdDoc = Nothing
Set wdApp = Nothing
End Sub
So lots of people can find it.
Eckard Buchner wrote:
>
> Thank you Dave, good idea. I got help in a word newsgroup. Here is the
> current version of my macro (raw as it is).
> Maybe, Debra, you have a look and add this to your great excel pages?
>
> Thanks
> Eckard
>
<<snipped>>
--
Dave Peterson
ec3...@msn.com