hi, 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:
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
barrowc
2010-09-29 16:29:39