Article ID: 238984 - Last Review: February 12, 2007 - Revision: 4.3

How To Improve the Performance of Office Automation Code

This article was previously published under Q238984
Expand all | Collapse all

SUMMARY

You can improve the performance of your Automation code in Microsoft Visual C++ by using a two-dimensional variant SAFEARRAY to read and write data in one attempt, and by using the clipboard to copy and paste data.

MORE INFORMATION

A common cause of speed problems with Automation involves repetitive reading and writing of data. This is typical for Excel Automation clients. However, most people are not aware that this data can usually be written or read in one attempt by using a two-dimensional variant SAFEARRAY.

For additional information about using SAFEARRAY, and for examples, please click the article numbers below to view the articles in the Microsoft Knowledge Base:
186120  (http://support.microsoft.com/kb/186120/EN-US/ ) How To Use MFC to Automate Excel and Fill a Range with an Array
186122  (http://support.microsoft.com/kb/186122/EN-US/ ) How To Use MFC to Automate Excel and Obtain an Array from a Range
179706  (http://support.microsoft.com/kb/179706/EN-US/ ) How To Use MFC to Automate Excel and Create/Format a New Workbook
Also, using the clipboard can sometimes improve performance. For instance, you can copy your data to the clipboard, and then use Automation to tell the server to perform a paste operation. You can also tell the server to copy data to the clipboard, and then paste the data into your application.

APPLIES TO
  • Microsoft Office XP Developer Edition
  • Microsoft Office 2000 Developer Edition
  • Microsoft Outlook 98 Standard Edition
  • Microsoft Visual C++ 6.0 Standard Edition
Keywords: 
kbfaq kbhowto KB238984
 

Article Translations

 

Related Support Centers