Is there away to add a pivot table to an Excel file through vb.net using Microsoft.ACE.OLEDB.12.0

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
I am using the following method to open and Excel file and fill it with data. It all works fine but I also need to add a pivot table. Is there a way?
<font face="Consolas" size="2" style="font-family:Consolas; font-size:x-small
myConnection =
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small New<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
System.Data.OleDb.<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small OleDbConnection<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (<span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small "provider=Microsoft.ACE.OLEDB.12.0;Data
Source="<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small & fileName_ &
<span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small ";Extended Properties=Excel 12.0 Xml;HDR=NO"<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small )
<span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; font-size:x-small myConnection.Open()
myCommand.Connection = myConnection
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small myCommand.CommandText =
<font face="Consolas" size="2" color="#a31515 <font face="Consolas" size="2" color="#a31515 <font face="Consolas" size="2" color="#a31515 "Insert into [sheet1$] (F1) values(33)" just a sample</font></font></font><span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small

myCommand.ExecuteNonQuery()







View the full article
 
Back
Top