工作簿共享vb.net

时间:2016-11-10 09:28:57

标签: excel vb.net visual-studio-2013

我在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

1 个答案:

答案 0 :(得分:0)

我解决了这个问题:

xlApp.Visible=False