How To Improve the Performance of Office Automation Code (238984)



The information in this article applies to:

  • Microsoft Office XP Developer
  • Microsoft Office 2000 Developer
  • Microsoft Outlook 98
  • Microsoft Visual C++ Standard Edition, version 6.0

This article was previously published under Q238984

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 How To Use MFC to Automate Excel and Fill a Range with an Array

186122 How To Use MFC to Automate Excel and Obtain an Array from a Range

179706 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.

Modification Type:MinorLast Reviewed:6/30/2004
Keywords:kbhowto KB238984