ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reading a CELL value from another Excel (https://www.excelbanter.com/excel-programming/335499-reading-cell-value-another-excel.html)

pp

Reading a CELL value from another Excel
 
Hi Folks

I have 2 Excel file(s)
File 1: ConnectionString.xls
This has a worksheet : GlobalConnString
In this worksheet, I have a TEXT value defined in the cell A1

File 2: MyReport.xls
This has a worksheet : Report-1

Requirement
========
Using VBA Code, I want to read the value in this worksheet from the file
<File1.<Worksheet1.<Cell1
<ConnectionString.xls.<ConnString.<A1
Is this possible?
If so, could somebody please let me know how?

Thanks
PP

keepITcool

Reading a CELL value from another Excel
 

Sub foo()
Dim strConn As String
'Fully qualified (tunnelled) object reference
strConn =
Workbooks("Connectionstring.xls").Worksheets("Glob alConnString").Range("
A1").Value
debug.print strConn

'Or via a global range..
strConn = Range("'[Connectionstring.xls]GlobalConnString'!A1").Value
debug.print strConn

End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


PP wrote :

Hi Folks

I have 2 Excel file(s)
File 1: ConnectionString.xls
This has a worksheet : GlobalConnString
In this worksheet, I have a TEXT value defined in the cell A1

File 2: MyReport.xls
This has a worksheet : Report-1

Requirement
========
Using VBA Code, I want to read the value in this worksheet from
the file <File1.<Worksheet1.<Cell1
<ConnectionString.xls.<ConnString.<A1
Is this possible?
If so, could somebody please let me know how?

Thanks
PP



All times are GMT +1. The time now is 01:33 AM.

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