ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get values from a closed workbook (https://www.excelbanter.com/excel-programming/366651-get-values-closed-workbook.html)

kev_06[_22_]

Get values from a closed workbook
 

I got this code from the website:

Sub test()
GetValuesFromAClosedWorkbook "C:", "Book1.xls", "Sheet1", "A1:A30"
End Sub

Sub GetValuesFromAClosedWorkbook(fPath As String, fName As String, _
sName, cellRange As String)

With ActiveSheet.Range(cellRange)
..FormulaArray = "='" & fPath & "\[" & fName & "]" & sName &
"'!" & _ cellRange
..Value = .Value
End With
End Sub

Can someone explain how it works? It looks like the path/file name is
already configured, so why (when I run the code) does an "Update
Records" dialog box pop up?


--
kev_06
------------------------------------------------------------------------
kev_06's Profile: http://www.excelforum.com/member.php...o&userid=35046
View this thread: http://www.excelforum.com/showthread...hreadid=559565


halim

Get values from a closed workbook
 
Dear KEV06,

Let me try to explain you that :
(the explanation is after " '--" and " _" mark & ended by dot.)

Sub test()
GetValuesFromAClosedWorkbook "C:", "Book1.xls", "Sheet1", "A1:A30"
' -- call _
GetValuesFromAClosedWorkbook sub event to raised up the event.
End Sub

Sub GetValuesFromAClosedWorkbook(fPath As String, fName As String, _
sName, cellRange As String)

With ActiveSheet.Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" & sName &
"'!" & cellRange ' -- excel _
standard way of linked cells to another Workbook that
currently not open.
.Value = .Value ' -- return formularray to value.
End With
End Sub


Or you can contact me directly to
thats all,

halim



kev_06 menuliskan:
I got this code from the website:

Sub test()
GetValuesFromAClosedWorkbook "C:", "Book1.xls", "Sheet1", "A1:A30"
End Sub

Sub GetValuesFromAClosedWorkbook(fPath As String, fName As String, _
sName, cellRange As String)

With ActiveSheet.Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" & sName &
"'!" & _ cellRange
.Value = .Value
End With
End Sub

Can someone explain how it works? It looks like the path/file name is
already configured, so why (when I run the code) does an "Update
Records" dialog box pop up?


--
kev_06
------------------------------------------------------------------------
kev_06's Profile:
http://www.excelforum.com/member.php...o&userid=35046
View this thread: http://www.excelforum.com/showthread...hreadid=559565



Ron de Bruin

Get values from a closed workbook
 
See
http://www.rondebruin.nl/copy7.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl



"kev_06" wrote in message
...

I got this code from the website:

Sub test()
GetValuesFromAClosedWorkbook "C:", "Book1.xls", "Sheet1", "A1:A30"
End Sub

Sub GetValuesFromAClosedWorkbook(fPath As String, fName As String, _
sName, cellRange As String)

With ActiveSheet.Range(cellRange)
FormulaArray = "='" & fPath & "\[" & fName & "]" & sName &
"'!" & _ cellRange
Value = .Value
End With
End Sub

Can someone explain how it works? It looks like the path/file name is
already configured, so why (when I run the code) does an "Update
Records" dialog box pop up?


--
kev_06
------------------------------------------------------------------------
kev_06's Profile: http://www.excelforum.com/member.php...o&userid=35046
View this thread: http://www.excelforum.com/showthread...hreadid=559565





All times are GMT +1. The time now is 12:31 PM.

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