Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I use the folowing code to get information from a closed workbook with ADO. It automatically selects the first sheet. How do I get it to select other sheets? e.g. sheet2 sub test() Dim dbConnection As ADODB.Connection, rs As ADODB.Recordset Dim dbConnectionString As String Dim i As Integer dbConnectionString = "DRIVER={Microsoft Excel Driver (*.xls)};" & "ReadOnly=1;DBQ=E:\AdoVBA\99budget.xls" Set dbConnection = New ADODB.Connection dbConnection.Open dbConnectionString ' open the database connection Set rs = dbConnection.Execute("[" & "a:a" & "]") Do While Not rs.EOF UserForm1.ListBox1.AddItem rs.Fields.Item(i) rs.MoveNext Loop rs.Close dbConnection.Close Set rs = Nothing Set dbConnection = Nothing End sub Help appreciated, Farmer |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to select all sheets | Excel Discussion (Misc queries) | |||
Select Multiple sheets | Excel Discussion (Misc queries) | |||
select a1 on all sheets | Excel Programming | |||
All Sheets Unhide and Select | Excel Programming | |||
select sheets by name - how? | Excel Programming |