Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default importing data from closed workbook

Hi,

I'm using below function to import data from a closed workbook :

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

I am now trying to assign the result directly to a variable, but the
following fails :

myvar=application.evaluate("''c:\Myworkbook[Mysheet]'!A1:Q250")

Anyone got any ideas why , or a solution to the problem ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default importing data from closed workbook

You need to have the workbook open for application.evaluate() to work.

lieven wrote:

Hi,

I'm using below function to import data from a closed workbook :

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

I am now trying to assign the result directly to a variable, but the
following fails :

myvar=application.evaluate("''c:\Myworkbook[Mysheet]'!A1:Q250")

Anyone got any ideas why , or a solution to the problem ?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing data from multiple closed workbooks Judy[_7_] Excel Programming 5 December 29th 05 10:46 PM
Help importing data from a closed workbook Elvis The King Excel Programming 1 August 31st 05 03:49 AM
add data to a closed workbook Spencer Hutton Excel Programming 2 April 9th 05 07:16 PM
getting data from closed workbook onedaywhen Excel Programming 0 April 2nd 04 09:08 AM
getting data from closed workbook John Williams[_4_] Excel Programming 0 April 1st 04 09:08 PM


All times are GMT +1. The time now is 07:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"