Вы находитесь на странице: 1из 4

12/18/13

Methods for transferring data to Excel from Visual Basic

Methods for transferring data to Excel from Visual Basic


Article ID: 247412 - View products that this article applies to.

This article was previously published under Q247412

SUMMARY
This article discusses numerous methods for transferring data to Microsoft Excel from your Microsoft Visual Basic application. This article also presents the advantages and the disadvantages for each method so that you can choose the solution that works best for you.

MORE INFORMATION
The approach most commonly used to transfer data to an Excel workbook is Automation. Automation gives you the greatest flexibility for specifying the location of your data in the workbook as well as the ability to format the workbook and make various settings at run time. With Automation, you can use several approaches for transferring your data: Transfer data cell by cell Transfer data in an array to a range of cells Transfer data in an ADO recordset to a range of cells using the CopyFromRecordset method Create a QueryTable on an Excel worksheet that contains the result of a query on an ODBC or OLEDB data source Transfer data to the clipboard and then paste the clipboard contents into an Excel worksheet There are also methods that you can use to transfer data to Excel that do not necessarily require Automation. If you are running an application server-side, this can be a good approach for taking the bulk of processing the data away from your clients. The following methods can be used to transfer your data without Automation: Transfer your data to a tab- or comma-delimited text file that Excel can later parse into cells on a worksheet Transfer your data to a worksheet using ADO Transfer data to Excel using Dynamic Data Exchange (DDE) The following sections provide more detail on each of these solutions. Note When you use Microsoft Office Excel 2007, you can use the new Excel 2007 Workbook (*.xlsx) file format when you save the workbooks. To do this, locate the following line of code in the following code examples: o B o o k . S a v e A s" C : \ B o o k 1 . x l s " Replace this code with with the following line of code: o B o o k . S a v e A s" C : \ B o o k 1 . x l s x " Additionally, the Northwind database is not included in Office 2007 by default. However, you can download the Northwind database from Microsoft Office Online.

Use Automation to transfer data cell by cell


With Automation, you can transfer data to a worksheet one cell at a time: D i mo E x c e lA sO b j e c tD i mo B o o kA sO b j e c tD i mo S h e e tA sO b j e c t' S t a r tan e ww o r k b o o ki nE x c e lS e to E x c e l= C r e a t e O b j e c t ( " E x c e l . A p p l i c a t i o n " )S e to B o o k=o E x c e l . W o r k b o o k s . A d d' A d dd a t at oc e l l so ft h ef i r s tw o r k s h e e ti nt h en e ww o r k b o o kS e t o S h e e t=o B o o k . W o r k s h e e t s ( 1 )o S h e e t . R a n g e ( " A 1 " ) . V a l u e=" L a s tN a m e "o S h e e t . R a n g e ( " B 1 " ) . V a l u e=" F i r s tN a m e " o S h e e t . R a n g e ( " A 1 : B 1 " ) . F o n t . B o l d=T r u eo S h e e t . R a n g e ( " A 2 " ) . V a l u e=" D o e "o S h e e t . R a n g e ( " B 2 " ) . V a l u e=" J o h n "' S a v et h eW o r k b o o ka n d Q u i tE x c e lo B o o k . S a v e A s" C : \ B o o k 1 . x l s "o E x c e l . Q u i t Transferring data cell by cell can be a perfectly acceptable approach if the amount of data is small. You have the flexibility to place data anywhere in the workbook and can format the cells conditionally at run time. However, this approach is not recommended if you have a large amount of data to transfer to an Excel workbook. Each Range object that you acquire at run time results in an interface request so that transferring data in this manner can be slow. Additionally, Microsoft Windows 95 and Windows 98 have a 64K limitation on interface requests. If you reach or exceed this 64k limit on interface requests, the Automation server (Excel) might stop responding or you might receive errors indicating low memory. This limitation for Windows 95 and Windows 98 is discussed in the following Knowledge Base article: 216400 (http://support.microsoft.com/kb/216400/ ) Cross-process COM automation can hang client application on Win 95/98 Once more, transferring data cell by cell is acceptable only for small amounts of data. If you need to transfer large data sets to Excel, you should consider one of the solutions presented later. For more sample code for Automating Excel, please see the following article in the Microsoft Knowledge Base: 219151 (http://support.microsoft.com/kb/219151/ ) How to automate Microsoft Excel from Visual Basic

Use automation to transfer an array of data to a range on a worksheet


An array of data can be transferred to a range of multiple cells at once: D i mo E x c e lA sO b j e c tD i mo B o o kA sO b j e c tD i mo S h e e tA sO b j e c t' S t a r tan e ww o r k b o o ki nE x c e lS e to E x c e l= C r e a t e O b j e c t ( " E x c e l . A p p l i c a t i o n " )S e to B o o k=o E x c e l . W o r k b o o k s . A d d' C r e a t ea na r r a yw i t h3c o l u m n sa n d1 0 0r o w sD i mD a t a A r r a y ( 1T o 1 0 0 ,1T o3 )A sV a r i a n tD i mrA sI n t e g e rF o rr=1T o1 0 0D a t a A r r a y ( r ,1 )=" O R D "&F o r m a t ( r ," 0 0 0 0 " )D a t a A r r a y ( r ,2 )=R n d ( )*1 0 0 0 D a t a A r r a y ( r ,3 )=D a t a A r r a y ( r ,2 )*0 . 7N e x t' A d dh e a d e r st ot h ew o r k s h e e to nr o w1S e to S h e e t=o B o o k . W o r k s h e e t s ( 1 ) o S h e e t . R a n g e ( " A 1 : C 1 " ) . V a l u e=A r r a y ( " O r d e rI D " ," A m o u n t " ," T a x " )' T r a n s f e rt h ea r r a yt ot h ew o r k s h e e ts t a r t i n ga tc e l lA 2

support.microsoft.com/kb/247412

1/4

12/18/13

Methods for transferring data to Excel from Visual Basic


o S h e e t . R a n g e ( " A 1 : C 1 " ) . V a l u e=A r r a y ( " O r d e rI D " ," A m o u n t " ," T a x " )' T r a n s f e rt h ea r r a yt ot h ew o r k s h e e ts t a r t i n ga tc e l lA 2 o S h e e t . R a n g e ( " A 2 " ) . R e s i z e ( 1 0 0 ,3 ) . V a l u e=D a t a A r r a y' S a v et h eW o r k b o o ka n dQ u i tE x c e lo B o o k . S a v e A s" C : \ B o o k 1 . x l s "o E x c e l . Q u i t

If you transfer your data using an array rather than cell by cell, you can realize an enormous performance gain with a large amount of data. Consider this line from the code above that transfers data to 300 cells in the worksheet: o S h e e t . R a n g e ( " A 2 " ) . R e s i z e ( 1 0 0 ,3 ) . V a l u e=D a t a A r r a y This line represents two interface requests (one for the Range object that the Range method returns and another for the Range object that the Resize method returns). On the other hand, transferring the data cell by cell would require requests for 300 interfaces to Range objects. Whenever possible, you can benefit from transferring your data in bulk and reducing the number of interface requests you make.

Use automation to transfer an ADO recordset to a worksheet range


Excel 2000 introduced the CopyFromRecordset method that allows you to transfer an ADO (or DAO) recordset to a range on a worksheet. The following code illustrates how you could automate Excel 2000, Excel 2002, or Office Excel 2003 and transfer the contents of the Orders table in the Northwind Sample Database using the CopyFromRecordset method. ' C r e a t eaR e c o r d s e tf r o ma l lt h er e c o r d si nt h eO r d e r st a b l eD i ms N W i n dA sS t r i n gD i mc o n nA sN e wA D O D B . C o n n e c t i o nD i mr sA s A D O D B . R e c o r d s e ts N W i n d=_" C : \ P r o g r a mF i l e s \ M i c r o s o f tO f f i c e \ O f f i c e \ S a m p l e s \ N o r t h w i n d . m d b "c o n n . O p e n " P r o v i d e r = M i c r o s o f t . J e t . O L E D B . 4 . 0 ; D a t aS o u r c e = "&_s N W i n d&" ; "c o n n . C u r s o r L o c a t i o n=a d U s e C l i e n tS e tr s=c o n n . E x e c u t e ( " O r d e r s " ,, a d C m d T a b l e )' C r e a t ean e ww o r k b o o ki nE x c e lD i mo E x c e lA sO b j e c tD i mo B o o kA sO b j e c tD i mo S h e e tA sO b j e c tS e to E x c e l= C r e a t e O b j e c t ( " E x c e l . A p p l i c a t i o n " )S e to B o o k=o E x c e l . W o r k b o o k s . A d dS e to S h e e t=o B o o k . W o r k s h e e t s ( 1 )' T r a n s f e rt h ed a t at oE x c e l o S h e e t . R a n g e ( " A 1 " ) . C o p y F r o m R e c o r d s e tr s' S a v et h eW o r k b o o ka n dQ u i tE x c e lo B o o k . S a v e A s" C : \ B o o k 1 . x l s "o E x c e l . Q u i t' C l o s et h e c o n n e c t i o nr s . C l o s ec o n n . C l o s e Note If you use the Office 2007 version of the Northwind database, you must replace the following line of code in the code example: c o n n . O p e n" P r o v i d e r = M i c r o s o f t . J e t . O L E D B . 4 . 0 ; D a t aS o u r c e = "&_s N W i n d&" ; " Replace this line of code with the following line of code: c o n n . O p e n" P r o v i d e r = M i c r o s o f t . A C E . O L E D B . 1 2 . 0 ; D a t aS o u r c e = "&_s N W i n d&" ; " Excel 97 also provides a CopyFromRecordset method but you can use it only with a DAO recordset. CopyFromRecordset with Excel 97 does not support ADO. For more information about using ADO and the CopyFromRecordset method, please see the following article in the Microsoft Knowledge Base: 246335 (http://support.microsoft.com/kb/246335/ ) How to transfer data from an ADO recordset to Excel with automation

Use automation to create a QueryTable on a worksheet


A QueryTable object represents a table built from data returned from an external data source. While automating Microsoft Excel, you can create a QueryTable by simply providing a connection string to an OLEDB or an ODBC data source along with an SQL string. Excel assumes the responsibility for generating the recordset and inserting it into the worksheet at the location you specify. Using QueryTables offers several advantages over the CopyFromRecordset method: Excel handles the creation of the recordset and its placement into the worksheet. The query can be saved with the QueryTable so that it can be refreshed at a later time to obtain an updated recordset. When a new QueryTable is added to your worksheet, you can specify that data already existing in cells on the worksheet be shifted to accommodate the new data (see the RefreshStyle property for details). The following code demonstrates how you could automate Excel 2000, Excel 2002, or Office Excel 2003 to create a new QueryTable in an Excel worksheet using data from the Northwind Sample Database: ' C r e a t ean e ww o r k b o o ki nE x c e lD i mo E x c e lA sO b j e c tD i mo B o o kA sO b j e c tD i mo S h e e tA sO b j e c tS e to E x c e l= C r e a t e O b j e c t ( " E x c e l . A p p l i c a t i o n " )S e to B o o k=o E x c e l . W o r k b o o k s . A d dS e to S h e e t=o B o o k . W o r k s h e e t s ( 1 )' C r e a t et h eQ u e r y T a b l eD i m s N W i n dA sS t r i n gs N W i n d=_" C : \ P r o g r a mF i l e s \ M i c r o s o f tO f f i c e \ O f f i c e \ S a m p l e s \ N o r t h w i n d . m d b "D i mo Q r y T a b l eA sO b j e c tS e to Q r y T a b l e= o S h e e t . Q u e r y T a b l e s . A d d (_" O L E D B ; P r o v i d e r = M i c r o s o f t . J e t . O L E D B . 4 . 0 ; D a t aS o u r c e = "&_s N W i n d&" ; " ,o S h e e t . R a n g e ( " A 1 " ) ," S e l e c t*f r o m O r d e r s " )o Q r y T a b l e . R e f r e s h S t y l e=x l I n s e r t E n t i r e R o w so Q r y T a b l e . R e f r e s hF a l s e' S a v et h eW o r k b o o ka n dQ u i tE x c e lo B o o k . S a v e A s " C : \ B o o k 1 . x l s "o E x c e l . Q u i t

Use the clipboard


The Windows Clipboard can also be used as a mechanism for transferring data to a worksheet. To paste data into multiple cells on a worksheet, you can copy a string where columns are delimited by tab characters and rows are delimited by carriage returns. The following code illustrates how Visual Basic can use its Clipboard object to transfer data to Excel: ' C o p yas t r i n gt ot h ec l i p b o a r dD i ms D a t aA sS t r i n gs D a t a=" F i r s t N a m e "&v b T a b&" L a s t N a m e "&v b T a b&" B i r t h d a t e "&v b C r_&" B i l l " &v b T a b&" B r o w n "&v b T a b&" 2 / 5 / 8 5 "&v b C r_&" J o e "&v b T a b&" T h o m a s "&v b T a b&" 1 / 1 / 9 1 "C l i p b o a r d . C l e a rC l i p b o a r d . S e t T e x ts D a t a ' C r e a t ean e ww o r k b o o ki nE x c e lD i mo E x c e lA sO b j e c tD i mo B o o kA sO b j e c tS e to E x c e l=C r e a t e O b j e c t ( " E x c e l . A p p l i c a t i o n " )S e to B o o k= o E x c e l . W o r k b o o k s . A d d' P a s t et h ed a t ao B o o k . W o r k s h e e t s ( 1 ) . R a n g e ( " A 1 " ) . S e l e c to B o o k . W o r k s h e e t s ( 1 ) . P a s t e' S a v et h eW o r k b o o ka n dQ u i t E x c e lo B o o k . S a v e A s" C : \ B o o k 1 . x l s "o E x c e l . Q u i t

Create a delimited text file that Excel can parse into rows and columns
Excel can open tab- or comma-delimited files and correctly parse the data into cells. You can take advantage of this feature when you want to transfer a large amount of data to a worksheet while using little, if any, Automation. This might be a good approach for a client-server application because the text file can be generated server-side. You can then open the text file at the client, using Automation where it is appropriate. The following code illustrates how you can create a comma-delimited text file from an ADO recordset: ' C r e a t eaR e c o r d s e tf r o ma l lt h er e c o r d si nt h eO r d e r st a b l eD i ms N W i n dA sS t r i n gD i mc o n nA sN e wA D O D B . C o n n e c t i o nD i mr sA s A D O D B . R e c o r d s e tD i ms D a t aA sS t r i n gs N W i n d=_" C : \ P r o g r a mF i l e s \ M i c r o s o f tO f f i c e \ O f f i c e \ S a m p l e s \ N o r t h w i n d . m d b "c o n n . O p e n

support.microsoft.com/kb/247412

2/4

12/18/13

A D O D B . R e c o r d s e tD i ms D a t aA sS t r i n gs N W i n d=_" C : \ P r o g r a mF i l e s \ M i c r o s o f tO f f i c e \ O f f i c e \ S a m p l e s \ N o r t h w i n d . m d b "c o n n . O p e n " P r o v i d e r = M i c r o s o f t . J e t . O L E D B . 4 . 0 ; D a t aS o u r c e = "&_s N W i n d&" ; "c o n n . C u r s o r L o c a t i o n=a d U s e C l i e n tS e tr s=c o n n . E x e c u t e ( " O r d e r s " ,, a d C m d T a b l e )' S a v et h er e c o r d s e ta sat a b d e l i m i t e df i l es D a t a=r s . G e t S t r i n g ( a d C l i p S t r i n g ,,v b T a b ,v b C r ,v b N u l l S t r i n g )O p e n " C : \ T e s t . t x t "F o rO u t p u tA s# 1P r i n t# 1 ,s D a t aC l o s e# 1' C l o s et h ec o n n e c t i o nr s . C l o s ec o n n . C l o s e' O p e nt h en e wt e x tf i l ei nE x c e l S h e l l" C : \ P r o g r a mF i l e s \ M i c r o s o f tO f f i c e \ O f f i c e \ E x c e l . e x e"&_C h r ( 3 4 )&" C : \ T e s t . t x t "&C h r ( 3 4 ) ,v b M a x i m i z e d F o c u s

Methods for transferring data to Excel from Visual Basic

Note If you use the Office 2007 version of the Northwind database, you must replace the following line of code in the code example: c o n n . O p e n" P r o v i d e r = M i c r o s o f t . J e t . O L E D B . 4 . 0 ; D a t aS o u r c e = "&_s N W i n d&" ; " Replace this line of code with the following line of code: c o n n . O p e n" P r o v i d e r = M i c r o s o f t . A C E . O L E D B . 1 2 . 0 ; D a t aS o u r c e = "&_s N W i n d&" ; " If your text file has a .CSV extension, Excel opens the file without displaying the Text Import Wizard and automatically assumes that the file is comma-delimited. Similarly, if your file has a .TXT extension, Excel automatically parse the file using tab delimiters. In the previous code sample, Excel was launched using the Shell statement and the name of the file was used as a command line argument. No Automation was used in the previous sample. However, if so desired, you could use a minimal amount of Automation to open the text file and save it in the Excel workbook format: ' C r e a t ean e wi n s t a n c eo fE x c e lD i mo E x c e lA sO b j e c tD i mo B o o kA sO b j e c tD i mo S h e e tA sO b j e c tS e to E x c e l= C r e a t e O b j e c t ( " E x c e l . A p p l i c a t i o n " )' O p e nt h et e x tf i l eS e to B o o k=o E x c e l . W o r k b o o k s . O p e n ( " C : \ T e s t . t x t " )' S a v ea sE x c e lw o r k b o o ka n d Q u i tE x c e lo B o o k . S a v e A s" C : \ B o o k 1 . x l s " ,x l W o r k b o o k N o r m a lo E x c e l . Q u i t For more information about using File I/O from your Visual Basic application, please see the following article in the Microsoft Knowledge Base: 172267 (http://support.microsoft.com/kb/172267/ ) RECEDIT.VBP demonstrates file I/O in Visual Basic

Transfer data to a worksheet by using ADO


Using the Microsoft Jet OLE DB Provider, you can add records to a table in an existing Excel workbook. A "table" in Excel is merely a range with a defined name. The first row of the range must contain the headers (or field names) and all subsequent rows contain the records. The following steps illustrate how you can create a workbook with an empty table named MyTable . E x c el 97, E x c el 2000, and E x c el 2003 1. Start a new workbook in Excel. 2. Add the following headers to cells A1:B1 of Sheet1: A1: FirstName B1: LastName Format cell B1 as right-aligned. Select A1:B1. On the Insert menu, choose Names and then select Define . Enter the name MyTable and click OK. Save the new workbook as C:\Book1.xls and quit Excel.

3. 4. 5. 6.

To add records to MyTable using ADO, you can use code similar to the following: ' C r e a t ean e wc o n n e c t i o no b j e c tf o rB o o k 1 . x l sD i mc o n nA sN e wA D O D B . C o n n e c t i o nc o n n . O p e n" P r o v i d e r = M i c r o s o f t . J e t . O L E D B . 4 . 0 ; "&_ " D a t aS o u r c e = C : \ B o o k 1 . x l s ; E x t e n d e dP r o p e r t i e s = E x c e l8 . 0 ; "c o n n . E x e c u t e" I n s e r ti n t oM y T a b l e( F i r s t N a m e ,L a s t N a m e ) "&_"v a l u e s ( ' B i l l ' ,' B r o w n ' ) "c o n n . E x e c u t e" I n s e r ti n t oM y T a b l e( F i r s t N a m e ,L a s t N a m e ) "&_"v a l u e s( ' J o e ' ,' T h o m a s ' ) "c o n n . C l o s e E x c el 2007 1. In Excel 2007, start a new workbook. 2. Add the following headers to cells A1:B1 of Sheet1: A1: FirstName B1: LastName Format cell B1 as right-aligned. Select A1:B1. On the Ribbon, click the Formulas tab, and then click Define Name . Type the name MyTable , and then click OK. Save the new workbook as C:\Book1.xlsx, and then quit Excel.

3. 4. 5. 6.

To add records to the MyTable table by using ADO, use code that resembles the following code example. ' C r e a t ean e wc o n n e c t i o no b j e c tf o rB o o k 1 . x l sD i mc o n nA sN e wA D O D B . C o n n e c t i o nc o n n . O p e n" P r o v i d e r = M i c r o s o f t . A C E . O L E D B . 1 2 . 0 ; "&_ " D a t aS o u r c e = C : \ B o o k 1 . x l s x ; E x t e n d e dP r o p e r t i e s = E x c e l1 2 . 0 ; "c o n n . E x e c u t e" I n s e r ti n t oM y T a b l e( F i r s t N a m e ,L a s t N a m e ) "&_"v a l u e s ( ' S c o t t ' ,' B r o w n ' ) "c o n n . E x e c u t e" I n s e r ti n t oM y T a b l e( F i r s t N a m e ,L a s t N a m e ) "&_"v a l u e s( ' J a n e ' ,' D o w ' ) "c o n n . C l o s e When you add records to the table in this manner, the formatting in the workbook is maintained. In the previous example, new fields added to column B are formatted with right alignment. Each record that is added to a row borrows the format from the row above it. You should note that when a record is added to a cell or cells in the worksheet, it overwrites any data previously in those cells; in other words, rows in the worksheet are not "pushed down" when new records are added. You should keep this in mind when designing the layout of data on your worksheets. Note The method to update data in an Excel worksheet by using ADO or by using DAO does not work in Visual Basic for Application environment within Access after you install Office 2003 Service Pack 2 (SP2) or after you install the update for Access 2002 that is included in Microsoft Knowledge Base article 904018. The method works well in Visual Basic for Application environment from other Office applications, such as Word, Excel, and Outlook. For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base: 904953 (http://support.microsoft.com/kb/904953/ ) You cannot change, add, or delete data in tables that are linked to an Excel workbook in Office Access 2003 or in Access 2002 904018 (http://support.microsoft.com/kb/904018/ ) Description of the update for Access 2002: October 18, 2005 For additional information on using ADO to access an Excel workbook, please see the following articles in the Microsoft Knowledge Base:

support.microsoft.com/kb/247412

3/4

12/18/13

For additional information on using ADO to access an Excel workbook, please see the following articles in the Microsoft Knowledge Base: 195951 (http://support.microsoft.com/kb/195951/ ) How to query and update Excel data using ADO from ASP

Methods for transferring data to Excel from Visual Basic

Use DDE to transfer data to Excel


DDE is an alternative to Automation as a means for communicating with Excel and transferring data; however, with the advent of Automation and COM, DDE is no longer the preferred method for communicating with other applications and should only be used when there is no other solution available to you. To transfer data to Excel using DDE, you can: Use the LinkPoke method to poke data to a specific range of cell(s), -orUse the LinkExecute method to send commands that Excel will execute. The following code example illustrates how to establish a DDE conversation with Excel so that you can poke data to cells on a worksheet and execute commands. Using this sample, for a DDE conversation to be successfully established to the LinkTopic Excel|MyBook.xls, a workbook with the name MyBook.xls must already be opened in a running instance of Excel. Note When you use Excel 2007, you can use the new .xlsx file format to save the workbooks. Make sure that you update the file name in the following code example. Note In this example, Text1 represents a Text Box control on a Visual Basic form: ' I n i t i a t eaD D Ec o m m u n i c a t i o nw i t hE x c e lT e x t 1 . L i n k M o d e=0T e x t 1 . L i n k T o p i c=" E x c e l | M y B o o k . x l s "T e x t 1 . L i n k I t e m=" R 1 C 1 : R 2 C 3 " T e x t 1 . L i n k M o d e=1' P o k et h et e x ti nT e x t 1t ot h eR 1 C 1 : R 2 C 3i nM y B o o k . x l sT e x t 1 . T e x t=" o n e "&v b T a b&" t w o "&v b T a b&" t h r e e "& v b C r&_" f o u r "&v b T a b&" f i v e "&v b T a b&" s i x "T e x t 1 . L i n k P o k e' E x e c u t ec o m m a n d st os e l e c tc e l lA 1( s a m ea sR 1 C 1 )a n dc h a n g et h e f o n t' f o r m a tT e x t 1 . L i n k E x e c u t e" [ S E L E C T ( " " R 1 C 1 " " ) ] "T e x t 1 . L i n k E x e c u t e" [ F O N T . P R O P E R T I E S ( " " T i m e sN e wR o m a n " " , " " B o l d " " , 1 0 ) ] " ' T e r m i n a t et h eD D Ec o m m u n i c a t i o nT e x t 1 . L i n k M o d e=0 When using LinkPoke with Excel, you specify the range in row-column (R1C1) notation for the LinkItem . If you are poking data to multiple cells, you can use a string where the columns are delimited by tabs and rows are delimited by carriage returns. When you use LinkExecute to ask Excel to carry out a command, you must give Excel the command in the syntax of the Excel Macro Language (XLM). The XLM documentation is not included with Excel versions 97 and later. For more information on how you can obtain the XLM documentation, please see the following article in the Microsoft Knowledge Base: 143466 (http://support.microsoft.com/kb/143466/ ) Macro97.exe file available on online services DDE is not a recommended solution for communicating with Excel. Automation provides the greatest flexibility and gives you more access to the new features that Excel has to offer.

REFERENCES
For more information, click the following article number to view the article in the Microsoft Knowledge Base: 306022 (http://support.microsoft.com/kb/306022/ ) How to transfer data to an Excel workbook by using Visual Basic .NET

Properties
Article ID: 247412 - Last Review: October 6, 2011 - Revision: 10.0 A P P LIE S TO
Microsoft Office Excel 2007 Microsoft Excel 2002 Standard Edition Microsoft Excel 2000 Standard Edition Microsoft Excel 97 Standard Edition Microsoft Visual Basic for Applications 6.0 Microsoft Visual Basic 6.0 Professional Edition Microsoft Office Excel 2003 Microsoft Excel 2010

K ey words : kbautomation kbdde kbinfo KB247412

support.microsoft.com/kb/247412

4/4

Вам также может понравиться