Hi i am having a problem, when i want to add data to an existing/opened spreadsheet in a vb.net program. the thing is i am writing a little program to save data to a spreadsheet until the spreadsheet is full without overwriting anything i have tried to do this for now:
oBook = xlApp.Workbooks.Add
oSheet = oBook.worksheets(1)
oSheet = oBook.activeSheet
oSheet.Range("A1").value = lblOrderNumber.Text
oSheet.Range("B1").value = lblQuantity.Text
oSheet.Range("C1").Value = lblWeight.Text
oSheet.Range("D1").Value = "Time _Scanned"
'Format cell dimension
oSheet.columns("A:A").ColumnWidth = 18
oSheet.Columns("B:B").ColumnWidth = 30
oSheet.Columns("C:C").ColumnWidth = 20
oSheet.Columns("D:D").ColumnWidth = 20
'Formating label to cell
oSheet.Range("A1:B1:C1:D1").Font.Bold = True
'Send data from textboxes to cells in excell
oSheet.Range("A2").Value = txtOrderNumber.Text
oSheet.Range("B2").Value = txtQuantity.Text
oSheet.Range("C2").Value = txtWeight.Text
oSheet.Range("D2").Value = TimeOfDay
'Save the workbook and quit Excel problem is here it askes me to overwrite an existing spreadsheet and dont want to do that, i want to keep on adding data please help
oBook.SaveAs(strName, True)
'oBook.Save()
oSheet = Nothing
xlApp.Quit()
xlApp = Nothing
Thanks a lot
oBook = xlApp.Workbooks.Add
oSheet = oBook.worksheets(1)
oSheet = oBook.activeSheet
oSheet.Range("A1").value = lblOrderNumber.Text
oSheet.Range("B1").value = lblQuantity.Text
oSheet.Range("C1").Value = lblWeight.Text
oSheet.Range("D1").Value = "Time _Scanned"
'Format cell dimension
oSheet.columns("A:A").ColumnWidth = 18
oSheet.Columns("B:B").ColumnWidth = 30
oSheet.Columns("C:C").ColumnWidth = 20
oSheet.Columns("D:D").ColumnWidth = 20
'Formating label to cell
oSheet.Range("A1:B1:C1:D1").Font.Bold = True
'Send data from textboxes to cells in excell
oSheet.Range("A2").Value = txtOrderNumber.Text
oSheet.Range("B2").Value = txtQuantity.Text
oSheet.Range("C2").Value = txtWeight.Text
oSheet.Range("D2").Value = TimeOfDay
'Save the workbook and quit Excel problem is here it askes me to overwrite an existing spreadsheet and dont want to do that, i want to keep on adding data please help
oBook.SaveAs(strName, True)
'oBook.Save()
oSheet = Nothing
xlApp.Quit()
xlApp = Nothing
Thanks a lot