View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Lund[_2_] Tim Lund[_2_] is offline
external usenet poster
 
Posts: 3
Default Workbook named range not seen by ADO when workbook closed

Running VBA in a separate workbook:

r is an ADODB recordset,
cnn a connection to an Excel workbook which includes
a sheet called IDB,
a workbook range name also called LEVEL_1, and
a named range whose name COUNTRY is a member of sheets("IDB").names.

The Excel workbook is not open.

Of the following alternative lines

r.Open "SELECT * FROM [IDB$]", cnn
r.Open "SELECT * FROM [IDB$A1:C50]", cnn
r.Open "SELECT * FROM [LEVEL_1]", cnn
r.Open "SELECT * FROM [IDB$COUNTRY]", cnn

the thiird produces an error - "Jet engine not able to find object
LEVEL_1.". But only when the workbook is closed.

Why?