Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
sathish sathish is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
garfield-n-odie [MVP] garfield-n-odie [MVP] is offline
external usenet poster
 
Posts: 2,587
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
sathish sathish is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Helmut Weber Helmut Weber is offline
external usenet poster
 
Posts: 139
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
sathish sathish is offline
external usenet poster
 
Posts: 4
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why dont MS just f**king re-write Word from scratch? Its dogsh*t Word Hater Microsoft Word Help 33 May 5th 23 02:52 PM
I am having difficulty with deleting headers and footers LHD New Users 5 July 24th 06 01:44 AM
Change paper size; Word changes to invalid margins OhioTech New Users 10 July 6th 06 02:00 PM
WP merge file to Word sstires Tables 4 February 14th 06 06:26 PM
How can Word display full path of a file in the title bar? SAsif Microsoft Word Help 1 January 26th 06 04:32 PM


All times are GMT +1. The time now is 04:42 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"