首页 > 代码库 > 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杂项拾零(持续更新中……)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。