I'm using vb.net express to call excel with this code
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim XL As Excel.Application Dim xlwb As Excel.Workbook Dim xlsheet As Excel.Worksheet
XL =
New Excel.Applicationxlwb = XL.Workbooks.Open(
"C:\Documents and Settings\S. Ross\My Documents\sales invoice1.xls")xlsheet = xlwb.Worksheets(1)
XL.Visible =
False Tryxlsheet.Cells(8, 2).select()
XL.Selection.value =
Me.NameComboBox.Text.ToStringxlsheet.Cells(9, 2).select()
XL.Selection.value =
Me.AddressTextBox.Text.ToStringxlsheet.Cells(10, 2).select()
XL.Selection.value = (
Me.CityTextBox.Text.ToString)xlsheet.Cells(10, 3).select()
XL.Selection.value = (
Me.StateTextBox.Text.ToString)xlsheet.Cells(11, 2).select()
XL.Selection.value =
Me.ZipTextBox.Text.ToStringxlsheet.Cells(4, 9).select()
XL.Selection.value =
Me.InvoiceIDTextBox.Text.ToStringxlsheet.Cells(5, 9).select()
XL.Selection.value =
Me.CustomerIDTextBox.Text.ToStringxlsheet.Cells(3, 9).select()
XL.Selection.value = DateTime.Today
Catch ex As Exception End Try Try Dim iddatatables As DataTable = Me.RCSDataSet.InvoiceDetails Dim idx As Integer = 1 For idx = 0 To iddatatables.Columns.Count - 1 Next Dim row As DataRow Dim rowidx As Integer = 15 For Each row In iddatatables.Rows For idx = 0 To iddatatables.Columns.Count - 1xlsheet.Cells(rowidx, idx + 1) = row(idx)
Nextrowidx = rowidx + 1
Next Catch End Tryxlsheet.PrintOut()
xlsheet =
Nothingxlwb =
NothingXL.Quit()
XL =
NothingGC.Collect()
End Sub
This prints the required invoice but only to row 36 on the excel worksheet, if I have more than 36 rows to print I need to be able to insert the rows at row 36 and push the rest of the rows down

inserting row in excel
Nichole158860
Hi
In VBA the command would be
Selection.Insert Shift:=xlDown
assuming that the currently selected row is the insertion point
Michael Bachar
Thanks,
Will post in the visual basic language forum to see if anyone knows how to accomplish this with vb.net.