【发布时间】:2017-03-24 06:30:27
【问题描述】:
我在 Visual Studio 2013 中创建了一个 Windows 应用程序表单。我需要将数据从表单输入到 Excel 工作表,直到用户关闭表单。工作簿将同时由多个用户共享。此外,我不希望他们看到工作簿,除非他们打开它。
我该怎么做?
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
【问题讨论】:
标签: excel vb.net visual-studio-2013