首页 > 代码库 > VSTO杂项拾零(持续更新中……)

VSTO杂项拾零(持续更新中……)

   环境:win 7+visual basic 2008     侧重:VSTO     界面:sheetbook工作簿

1.创建一个过程并调用(2017.6.3)

Public Class Sheet1
    Private Sub Fileprocessor(ByVal fileName As String)
        Dim fs As System.IO.FileStream = New System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read)
        fs.Close()
    End Sub

    Private Sub Sheet1_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
        Fileprocessor("c:\download\csvdata.txt")
    End Sub

    Private Sub Sheet1_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown

    End Sub


End Class

 2.读取TXT文件并显示在sheet1的单元格中(2017.6.3)

Public Class Sheet1

    Private Sub Sheet1_Startup1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
        Application.ScreenUpdating = False
        Application.Workbooks.Open("C:\download\csvdata.txt", Delimiter:="", Editable:=True, AddToMru:=True)
        Application.ScreenUpdating = True
    End Sub
    Private Sub sheet1_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown

    End Sub
End Class

 

VSTO杂项拾零(持续更新中……)