Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
converting word to excel
hi everyone,
i have a word document which contains tables. i want to convert the tables into excel sheet. is there any simple way. |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
converting word to excel
Copy and paste?
sathish wrote: hi everyone, i have a word document which contains tables. i want to convert the tables into excel sheet. is there any simple way. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
converting word to excel
is that the only solution bcos my document contains more than 300 pages.
"garfield-n-odie [MVP]" wrote: Copy and paste? sathish wrote: hi everyone, i have a word document which contains tables. i want to convert the tables into excel sheet. is there any simple way. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
converting word to excel
Hi Sathish,
if you really want to accelerate form 1 mph to mach 1, then: Sub ExcelTest01() Dim oExc As Excel.Application Dim oWrk As Excel.Workbook Dim oSht As Excel.Worksheet Dim wTbl As Word.Table Dim lCnt As Long Dim lRow As Long Dim lClm As Long Dim x As Long Dim y As Long Set oExc = New Excel.Application oExc.Workbooks.Add Set oWrk = oExc.Workbooks(1) For lCnt = oWrk.Worksheets.Count To 2 Step -1 oWrk.Worksheets(lCnt).Delete Next oExc.Visible = False ' maybe redundant With ActiveDocument For lCnt = 1 To .Tables.Count Set oSht = oWrk.ActiveSheet oSht.Name = "MySheet-" & Format(lCnt, "000") Set wTbl = .Tables(lCnt) lRow = wTbl.Rows.Count lClm = wTbl.Columns.Count For x = 1 To lClm For y = 1 To lRow oSht.Cells(y, x).Value = _ Left(wTbl.Cell(y, x).Range.Text, _ Len(wTbl.Cell(y, x).Range.Text) - 2) Next Next If lCnt = .Tables.Count Then GoTo Ende oWrk.Worksheets.Add After:=oSht oExc.ActiveSheet.Name = "MySheet-" & Format(lCnt + 1, "000") Next End With Ende: MsgBox "ende (german for ""end"")" oWrk.SaveAs "c:\test\yes.xls" oWrk.Close oExc.quit Set oExc = Nothing Set oWrk = Nothing Set oSht = Nothing Set wTbl = Nothing End Sub I know, this is very hard for a beginner. Just give it a chance. -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
converting word to excel
Hi Weber,
thank you i got ur coding working and it helped me a lot in my work regards sathish "Helmut Weber" wrote: Hi Sathish, if you really want to accelerate form 1 mph to mach 1, then: Sub ExcelTest01() Dim oExc As Excel.Application Dim oWrk As Excel.Workbook Dim oSht As Excel.Worksheet Dim wTbl As Word.Table Dim lCnt As Long Dim lRow As Long Dim lClm As Long Dim x As Long Dim y As Long Set oExc = New Excel.Application oExc.Workbooks.Add Set oWrk = oExc.Workbooks(1) For lCnt = oWrk.Worksheets.Count To 2 Step -1 oWrk.Worksheets(lCnt).Delete Next oExc.Visible = False ' maybe redundant With ActiveDocument For lCnt = 1 To .Tables.Count Set oSht = oWrk.ActiveSheet oSht.Name = "MySheet-" & Format(lCnt, "000") Set wTbl = .Tables(lCnt) lRow = wTbl.Rows.Count lClm = wTbl.Columns.Count For x = 1 To lClm For y = 1 To lRow oSht.Cells(y, x).Value = _ Left(wTbl.Cell(y, x).Range.Text, _ Len(wTbl.Cell(y, x).Range.Text) - 2) Next Next If lCnt = .Tables.Count Then GoTo Ende oWrk.Worksheets.Add After:=oSht oExc.ActiveSheet.Name = "MySheet-" & Format(lCnt + 1, "000") Next End With Ende: MsgBox "ende (german for ""end"")" oWrk.SaveAs "c:\test\yes.xls" oWrk.Close oExc.quit Set oExc = Nothing Set oWrk = Nothing Set oSht = Nothing Set wTbl = Nothing End Sub I know, this is very hard for a beginner. Just give it a chance. -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why dont MS just f**king re-write Word from scratch? Its dogsh*t | Microsoft Word Help | |||
I am having difficulty with deleting headers and footers | New Users | |||
Change paper size; Word changes to invalid margins | New Users | |||
WP merge file to Word | Tables | |||
How can Word display full path of a file in the title bar? | Microsoft Word Help |