How do I write to an Excel sheet in an specific cell using VB.NET and Microsoft.ACE.OLEDB.12.0

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I need to write to specific Cell in Excel file such as G2. the folowwing does not work for me. Is there a way to do this??
<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 <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
myConnection =
<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 <span style="font-family:Consolas; font-size:x-small 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 <span style="font-size:x-small myConnection.Open()
<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 <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 =<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 "Insert into [sheet1$] (G2)
values(33)"<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; font-size:x-small <span style="font-family:Consolas; font-size:x-small myCommand.ExecuteNonQuery()


View the full article
 
Back
Top