ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with named Range in ADO extract from Closed Excel File (https://www.excelbanter.com/excel-programming/286010-problem-named-range-ado-extract-closed-excel-file.html)

Dave Bash

Problem with named Range in ADO extract from Closed Excel File
 
I have used the ADO method to extract cell data from a closed Excel
file in the past successfully but in my current efforts I am using a
named range which does not appear on the first sheet (putting in a
simple a1:d10 as the range does work but grabs front sheet). The
argument in the call is like this:

GetDataFromClosedWorkbook "C:\FolderName\WorkbookName.xls",
"MyDataRange", Range ("B3"), True

where MyDataRange is a range on the 10th sheet named "Projected" and
has a first row which consists of AccountName,and then dates all the
way across.

The code errors out to the error handler at the line:
Set rs = dbConnection.Execute("[" & SourceRange & "]")


this is the source for the code - and the platform is xl2000 on
win2000.

http://www.erlandsendata.no/english/...mportwbado.htm

Thanks

onedaywhen

Problem with named Range in ADO extract from Closed Excel File
 
Try calling your function like this:

GetDataFromClosedWorkbook "C:\FolderName\WorkbookName.xls", _
"Projected$MyDataRange", Range ("B3"), True

--

(Dave Bash) wrote in message . com...
I have used the ADO method to extract cell data from a closed Excel
file in the past successfully but in my current efforts I am using a
named range which does not appear on the first sheet (putting in a
simple a1:d10 as the range does work but grabs front sheet). The
argument in the call is like this:

GetDataFromClosedWorkbook "C:\FolderName\WorkbookName.xls",
"MyDataRange", Range ("B3"), True

where MyDataRange is a range on the 10th sheet named "Projected" and
has a first row which consists of AccountName,and then dates all the
way across.

The code errors out to the error handler at the line:
Set rs = dbConnection.Execute("[" & SourceRange & "]")


this is the source for the code - and the platform is xl2000 on
win2000.

http://www.erlandsendata.no/english/...mportwbado.htm

Thanks



All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com