Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Slow VBA Word after installing Windows XP Service Pack 2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ergun - 12 Dec 2004 23:57 GMT
I have a VBA/Word application written under .NET framework 1.1 accessing
Microsoft Word 9.0 Object Library through COM interoperobility layer. This
application performed well until Windows XP Service Pack 2 is installed. Now
it performs poorly and nearly 8-10 X slower accross all Word calls. That is,
not just one particular function call through COM interoperob is slower, but
seems like ALL Word functions are running much slower consistently (this has
been proved with intensive tracing). In a nutshell the application renders
tables and colorizes rows or cells using code like:

        Word._Document doc = (Word._Document)rc.Document;

        Word.Range range = (Word.Range)rc.Range.Range;
       
        Word.Table wt = null;

           wt = range.ConvertToTable(
              ref seperator,
              ref numrows,
              ref numcols,
              ref initialcolwidth,
              ref format,
              ref applyBorders,       // Apply borders
              ref applyShading,       // Apply Shading
              ref applyFont,          // Apply Font
              ref applyColor,         // Apply Color
              ref applyHeading,       // Apply Heading Rows
              ref falseVal,            // Apply Last Row
              ref falseVal,           // Apply First Column
              ref falseVal,           // Apply Last Column
              ref falseVal,           // AutoFit
              ref afitbvor,           // AutoFit Behaviour
              ref tabbvor );          // Default Table Behaviour

           wt.Select();
           Word.Selection sel = doc.Application.Selection;

          sel.Tables.Item(1).Cell( 1, 1).Select();
          sel.SelectRow();
          sel.Cells.Shading.BackgroundPatternColor = (Word.WdColor)par.Color;

Great care was spent to make the code efficient using word table rendering
techniques given in MVP site :

(http://word.mvps.org/FAQs/TblsFldsFms/FastTables.htm).

Stopping disabling the Virus check program or various other services by
elimination didn't make any difference.

I suspect .NET Framework SP 1 which came with KB867460 (and which is now
included in Windows XP Service Pack 2) could also have played part in this.

My hunch is something to do with a combination of COM Interoperob layer and
additional security checks/fixes introduced in the service pack causing
perhaps dubious retries or timeouts somewhere.

Thanks in advance..
Signature

Regards
8-)
Ergun

Ergun - 14 Dec 2004 00:37 GMT
This is turned out to be a false alarm. I found an XP SP2 machine and Interop
runs very fast (100 rows table is rendered in 600ms), whereas on some XP SP2
machines the same test takes about 6s. I suspect something to do with Interop
performance related to security (above two machines had different domains).
Used SuppressUnmanagedCodeSecurityAttribute in the Interop libraries (i.e.
built with tlbimp \unsafe switch), didn't make any difference. Problem
persists. Any help will be appreciated.

> I have a VBA/Word application written under .NET framework 1.1 accessing
> Microsoft Word 9.0 Object Library through COM interoperobility layer. This
[quoted text clipped - 52 lines]
>
> Thanks in advance..

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.