user5538704 user5538704 - 10 days ago 5
Vb.net Question

Workbook sharing vb.net

I have a windows application form created in visual studio 2013. I need to enter data from form to excel sheet until the users close the form. The workbook will be shared by multiple users at the same time. Moreover, I do not want them to see the workbook unless they open it.

How do I do this?

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
xlWorkBook = xlApp.Workbooks.Open("C:\1.xlsx")
xlWorkSheet = xlWorkBook.Sheets("Sheet1")
Dim iRow As Long
Dim alpha As Long = 0
iRow = 5
With xlWorkSheet
Do While .Cells(iRow, 2).value <> ""
iRow = iRow + 1
Loop

.Cells(iRow, 2).Value = t1.Text
.Cells(iRow, 3).Value = t2.Text
.Cells(iRow, 5).Value = t3.Text
End With
xlApp.DisplayAlerts = False
xlWorkBook.Save()
End Sub

Answer

I solved this:

xlApp.Visible=False
Comments