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: 13
Default Faster opening of Word files

Hello everyone,
I recently made a macro which would search for specific keywords in a
list of Microsoft word files and find the number of occurance of the
particular keyword. The problem is that everytime this macro opens a
new word file, it takes a lot of time. I am new to object oriented
programming. If anybody has any ideas of making this macro faster,
please suggest. Thank you.

A core part of the macro is as given below.

-----------------------------------------------------

For Each nDocFile In Range("B4:B" & FindLastRow("B4")).Cells
sDoc = Range("B1").Value & "\" & nDocFile.Value
Set wordApp = CreateObject("Word.Application")
nDocFile.Select
wordApp.Documents.Open (sDoc)
wordApp.Visible = False

For Each nWord In Range(Cells(3, 4), Cells(3, UBound(aKeywords) +
3)).Cells
sText = nWord

With wordApp.Selection.Find
.MatchWholeWord = True
Counter = 0
Do While .Execute(FindText:=sText, Forward:=True) =
True
Counter = Counter + 1
Loop
End With

nDocFile.Offset(0, nWord.Column - 2).Value = Counter

Next

wordApp.Quit
Set wordApp = Nothing

Next

 
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
Issue with Details View when opening files in Excel, Word, etc. JrCT040 Excel Discussion (Misc queries) 1 July 26th 09 08:24 AM
Opening files by double clicking takes for ever - Word, Excel Scott Townsend Setting up and Configuration of Excel 3 July 31st 08 01:17 PM
excel, word freeze when opening files sam Excel Discussion (Misc queries) 1 April 24th 06 06:49 PM
Opening Word Files in excel sheets JAGJEET Excel Programming 1 October 18th 05 03:11 PM
opening workbooks faster inquirer Excel Programming 1 May 18th 04 12:41 PM


All times are GMT +1. The time now is 10:08 PM.

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

About Us

"It's about Microsoft Excel"