Discussion Locked

Select Excel spreadsheet from V Basic

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am interested in using Visual Basic to select and open an Excel spreadsheet in a particular directory.

Thank you.

1 reply

by tclere

Here is some code to get you started:

Dim xlapp As Excel.Application
Dim xlWB As Workbook
Dim xlWS As Worksheet

Set xlapp = New Excel.Application

xlapp.Workbooks.Open _
FileName:="C:\Temp\SomeFile.xls"

Set xlWB = xlapp.ActiveWorkbook

xlapp.Visible = True

Set xlWS = xlWB.Sheets("Sheet1")

Hope this helps!

This discussion is closed to new replies.