Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Robert,
Am Thu, 2 May 2013 13:56:01 -0700 schrieb Robert Crandal: What does your final code look like for this entire function? Sub ImportFromWord() Dim objWord As Object Dim oTable As Table Dim oRow As Row Dim r As Integer ' Load target Word document Set objWord = CreateObject("Word.Application") objWord.documents.Open ("C:\Users\Claus Busch\Desktop\Test.docx") objWord.Visible = True objWord.Activate Set oTable = objWord.ActiveDocument.Tables(1) ' Go through all rows of Word table For r = 1 To oTable.Rows.Count Set oRow = oTable.Rows(r) ' Paste data back into Excel. This Word table has 6 columns Sheet1.Cells(r, 1).Value = oRow.Cells(1).Range.Text Sheet1.Cells(r, 2).Value = oRow.Cells(2).Range.Text Sheet1.Cells(r, 3).Value = oRow.Cells(3).Range.Text Sheet1.Cells(r, 4).Value = oRow.Cells(4).Range.Text Sheet1.Cells(r, 5).Value = oRow.Cells(5).Range.Text Sheet1.Cells(r, 6).Value = oRow.Cells(6).Range.Text Next r For r = 1 To 6 Columns(r).TextToColumns Destination:=Cells(1, r), _ DataType:=xlDelimited, Tab:=True, fieldinfo:=Array(1, 1) Next ' Quit Word objWord.Application.Quit End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to load data into excel? | Excel Discussion (Misc queries) | |||
Saving excel data to load into word | Excel Worksheet Functions | |||
Cannot load Excel 2000 Addin from Word (and that's so weird!) | Excel Programming | |||
Is anything needed if I only load Word & Excel from Office XP Sta. | Excel Discussion (Misc queries) | |||
opening a word document from excel: file still won't load | Excel Programming |