开发者

VBA code for read an Excel file

I want to make an excel file read using a VBA code in a simulation software. Please let me know how 开发者_运维问答can I do this?


A very basic outline would be:

Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")

xlApp.Workbooks.Open "C:\foo.xls"

' do stuff here

xlApp.Quit
Set xlApp = Nothing

Depending on what you actually want to achieve you may want to consider:

  • saving an Excel worksheet as a CSV (comma separated value) file and reading directly from the CSV file
  • using ADO to treat an Excel worksheet as a database table so that you can use SQL to read from it
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜