LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Import Word Table Macro running very slow

Hello All,
I am using Windows XP/Office 2003

I am running this macro from excel (downloaded from newsgroup) which
reads the information from Word Tables in Excel.

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:="C:\Test.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.Close
wdApp.Quit
Set wdDoc = Nothing
Set wdApp = Nothing


End Sub

I am facing the folloiwng problems with the above macro.
When the macro runs

1) Word Document (Test.doc) is shown after about 10-15 second on the
screen with the cursor blinking - I wish this not to be displayed

2) Excel file is displayed reading from the Word Table and inserting
info in the cells of Excel...this process is very very slow.. It takes
about two to two and a half minutes to insert a 40 Rows x 11 Columns
information.

3) I have to select all rows and column and do Autofit manually for
rows and columns - Can this be done automatically.



Can anyone help me to speed up this please?

TIA

Rashid Khan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Running very slow Seanie Excel Programming 5 March 7th 10 12:29 PM
Macro Running Painfully Slow! bigV Excel Discussion (Misc queries) 5 May 31st 08 12:41 AM
Really Slow Running of Macro John Excel Programming 3 January 15th 06 05:33 PM
MY EXEL/WORD OFFICE 2000 IS RUNNING VERY SLOW AFTER DOWNLOADING U. STEVE CAMPBELL Excel Discussion (Misc queries) 1 December 7th 04 05:59 PM
slow down a running macro terry down Excel Programming 2 August 30th 03 10:42 PM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"