怎样在vb中导入excel表格数据
展开全部
可以看vb自带的例子visdata,其中对txt文件和对excel文件的操作都有很详细的说明。
也可能通过以下方式:
引用micsosoft Excel x.0 object Library
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
FileCopy App.Path + "\rpf.xlt", App.Path + "\tmp.xlt"
FileName = App.Path + "\tmp.xls"
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(FileName)
xlApp.Visible = True
Set xlsheet = xlBook.Sheets("sheet1")
with xlsheet
.Cells(1, 1) =变量
end with
也可能通过以下方式:
引用micsosoft Excel x.0 object Library
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
FileCopy App.Path + "\rpf.xlt", App.Path + "\tmp.xlt"
FileName = App.Path + "\tmp.xls"
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(FileName)
xlApp.Visible = True
Set xlsheet = xlBook.Sheets("sheet1")
with xlsheet
.Cells(1, 1) =变量
end with
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询