Getting info from closed Excel files

Hi,

I have a number of excel files that my sales team use for forecasting and it 
would be great to have a single file where I could pull in all the 
information to.

All the forecast sheets are the same so I know the cells that I want to pull 
in and I would even know the names.

I'm using Office 2007 with Vista.

Your help or guidance would be appreciated.

Thanks

Steve
0
Utf
11/23/2009 11:51:02 AM
excel.programming 6508 articles. 2 followers. Follow

14 Replies
911 Views

Similar Articles

[PageSpeed] 15

Hi,

You have to have the sheet open to get the data from it. The following is as 
seamless a way as I can think of to leave the user unaware of this:

Sub test()

Application.ScreenUpdating = False
Application.DisplayAlerts = False

Dim wb As Workbook
Set wb = Workbooks.Open("C:\path\test.xls")

Range("A1").Value = wb.Worksheets("MySheetName").Range("C5").Value

wb.Close

Application.DisplayAlerts = True

End Sub

"Steve" wrote:

> Hi,
> 
> I have a number of excel files that my sales team use for forecasting and it 
> would be great to have a single file where I could pull in all the 
> information to.
> 
> All the forecast sheets are the same so I know the cells that I want to pull 
> in and I would even know the names.
> 
> I'm using Office 2007 with Vista.
> 
> Your help or guidance would be appreciated.
> 
> Thanks
> 
> Steve
0
Utf
11/23/2009 12:04:02 PM
I am doing that kind of stuff through ADO technology since years and it woks 
fine ...
Assuming the data area you are interested to recover are named you would 
have first to establish a connection toward each of those closed workbook 
having those named areas inside then once done launch a SQL request on the 
named table... All the rest is pure data manipulation...

Can give a little bit more on demand...
Alain

"Steve" wrote:

> Hi,
> 
> I have a number of excel files that my sales team use for forecasting and it 
> would be great to have a single file where I could pull in all the 
> information to.
> 
> All the forecast sheets are the same so I know the cells that I want to pull 
> in and I would even know the names.
> 
> I'm using Office 2007 with Vista.
> 
> Your help or guidance would be appreciated.
> 
> Thanks
> 
> Steve
0
Utf
11/23/2009 12:13:07 PM
Steve,
you should be able to do this using formula without the need to open the file.

try following and see if it helps. Change file name \ folder \ worksheet 
name as required

Sub GetData()
    Dim mydata As String
    
    'data location & range to copy
    '<< change as required
    mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"

    'link to destination worksheet
    '<< change as required
    With ThisWorkbook.Worksheets(1).Range("B2:F12")
        .Formula = mydata

        'convert formula to text
        .Value = .Value
        
    End With
    
End Sub
-- 
jb


"Steve" wrote:

> Hi,
> 
> I have a number of excel files that my sales team use for forecasting and it 
> would be great to have a single file where I could pull in all the 
> information to.
> 
> All the forecast sheets are the same so I know the cells that I want to pull 
> in and I would even know the names.
> 
> I'm using Office 2007 with Vista.
> 
> Your help or guidance would be appreciated.
> 
> Thanks
> 
> Steve
0
Utf
11/23/2009 12:18:01 PM
Thanks for your response, it gives me something to try.

Steve

"Steve" wrote:

> Hi,
> 
> I have a number of excel files that my sales team use for forecasting and it 
> would be great to have a single file where I could pull in all the 
> information to.
> 
> All the forecast sheets are the same so I know the cells that I want to pull 
> in and I would even know the names.
> 
> I'm using Office 2007 with Vista.
> 
> Your help or guidance would be appreciated.
> 
> Thanks
> 
> Steve
0
Utf
11/23/2009 1:14:02 PM
Thanks John

I will give this a go and see how I get on.

It would be ideal if i could do it without having them open.

Appreciate you help

Steve

"Steve" wrote:

> Hi,
> 
> I have a number of excel files that my sales team use for forecasting and it 
> would be great to have a single file where I could pull in all the 
> information to.
> 
> All the forecast sheets are the same so I know the cells that I want to pull 
> in and I would even know the names.
> 
> I'm using Office 2007 with Vista.
> 
> Your help or guidance would be appreciated.
> 
> Thanks
> 
> Steve
0
Utf
11/23/2009 1:17:02 PM
Hi

I tried the following code from John which works OK except it brings up the 
open dialogue box. As sson as I select file and OK it poulates the cell in my 
master file.

Can I do it without going through the "Open Dialogue" box?

Private Sub CmdGetData_Click()

Dim mydata As String

'data location & range to copy
'<< change as required
'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
Forecast.xlsm]Summary'!$B$2:$B$2"

'link to destination worksheet
'<< change as required
With ThisWorkbook.Worksheets(1).Range("B2:B2")
    .Formula = mydata

    'convert formula to text
    .Value = .Value
    
End With
    

End Sub



"john" wrote:

> Steve,
> you should be able to do this using formula without the need to open the file.
> 
> try following and see if it helps. Change file name \ folder \ worksheet 
> name as required
> 
> Sub GetData()
>     Dim mydata As String
>     
>     'data location & range to copy
>     '<< change as required
>     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> 
>     'link to destination worksheet
>     '<< change as required
>     With ThisWorkbook.Worksheets(1).Range("B2:F12")
>         .Formula = mydata
> 
>         'convert formula to text
>         .Value = .Value
>         
>     End With
>     
> End Sub
> -- 
> jb
> 
> 
> "Steve" wrote:
> 
> > Hi,
> > 
> > I have a number of excel files that my sales team use for forecasting and it 
> > would be great to have a single file where I could pull in all the 
> > information to.
> > 
> > All the forecast sheets are the same so I know the cells that I want to pull 
> > in and I would even know the names.
> > 
> > I'm using Office 2007 with Vista.
> > 
> > Your help or guidance would be appreciated.
> > 
> > Thanks
> > 
> > Steve
0
Utf
11/23/2009 1:31:02 PM
I have now put in a \ after "Forecast Test" and it does not ask for a sheet 
anymore, just the file name

"Steve" wrote:

> Hi
> 
> I tried the following code from John which works OK except it brings up the 
> open dialogue box. As sson as I select file and OK it poulates the cell in my 
> master file.
> 
> Can I do it without going through the "Open Dialogue" box?
> 
> Private Sub CmdGetData_Click()
> 
> Dim mydata As String
> 
> 'data location & range to copy
> '<< change as required
> 'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
> Forecast.xlsm]Summary'!$B$2:$B$2"
> 
> 'link to destination worksheet
> '<< change as required
> With ThisWorkbook.Worksheets(1).Range("B2:B2")
>     .Formula = mydata
> 
>     'convert formula to text
>     .Value = .Value
>     
> End With
>     
> 
> End Sub
> 
> 
> 
> "john" wrote:
> 
> > Steve,
> > you should be able to do this using formula without the need to open the file.
> > 
> > try following and see if it helps. Change file name \ folder \ worksheet 
> > name as required
> > 
> > Sub GetData()
> >     Dim mydata As String
> >     
> >     'data location & range to copy
> >     '<< change as required
> >     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > 
> >     'link to destination worksheet
> >     '<< change as required
> >     With ThisWorkbook.Worksheets(1).Range("B2:F12")
> >         .Formula = mydata
> > 
> >         'convert formula to text
> >         .Value = .Value
> >         
> >     End With
> >     
> > End Sub
> > -- 
> > jb
> > 
> > 
> > "Steve" wrote:
> > 
> > > Hi,
> > > 
> > > I have a number of excel files that my sales team use for forecasting and it 
> > > would be great to have a single file where I could pull in all the 
> > > information to.
> > > 
> > > All the forecast sheets are the same so I know the cells that I want to pull 
> > > in and I would even know the names.
> > > 
> > > I'm using Office 2007 with Vista.
> > > 
> > > Your help or guidance would be appreciated.
> > > 
> > > Thanks
> > > 
> > > Steve
0
Utf
11/23/2009 1:43:02 PM
Steve,
I rather suspect the Open Dialog is appearing because the filename in your 
code cannot be found - Check your path & spelling is as it should be & try 
again.
-- 
jb


"Steve" wrote:

> Hi
> 
> I tried the following code from John which works OK except it brings up the 
> open dialogue box. As sson as I select file and OK it poulates the cell in my 
> master file.
> 
> Can I do it without going through the "Open Dialogue" box?
> 
> Private Sub CmdGetData_Click()
> 
> Dim mydata As String
> 
> 'data location & range to copy
> '<< change as required
> 'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
> Forecast.xlsm]Summary'!$B$2:$B$2"
> 
> 'link to destination worksheet
> '<< change as required
> With ThisWorkbook.Worksheets(1).Range("B2:B2")
>     .Formula = mydata
> 
>     'convert formula to text
>     .Value = .Value
>     
> End With
>     
> 
> End Sub
> 
> 
> 
> "john" wrote:
> 
> > Steve,
> > you should be able to do this using formula without the need to open the file.
> > 
> > try following and see if it helps. Change file name \ folder \ worksheet 
> > name as required
> > 
> > Sub GetData()
> >     Dim mydata As String
> >     
> >     'data location & range to copy
> >     '<< change as required
> >     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > 
> >     'link to destination worksheet
> >     '<< change as required
> >     With ThisWorkbook.Worksheets(1).Range("B2:F12")
> >         .Formula = mydata
> > 
> >         'convert formula to text
> >         .Value = .Value
> >         
> >     End With
> >     
> > End Sub
> > -- 
> > jb
> > 
> > 
> > "Steve" wrote:
> > 
> > > Hi,
> > > 
> > > I have a number of excel files that my sales team use for forecasting and it 
> > > would be great to have a single file where I could pull in all the 
> > > information to.
> > > 
> > > All the forecast sheets are the same so I know the cells that I want to pull 
> > > in and I would even know the names.
> > > 
> > > I'm using Office 2007 with Vista.
> > > 
> > > Your help or guidance would be appreciated.
> > > 
> > > Thanks
> > > 
> > > Steve
0
Utf
11/23/2009 1:53:02 PM
Hi John

I added the display alerts / ScreenUpdating and that seems to do the trick.

However, because the value I'm getting from the file is made up from a 
formula, it rerturns £0.00. If I get a text value it works fine.

Any ideas?

Thanks

Steve




Private Sub CmdGetData_Click()

Dim mydata As String

Application.ScreenUpdating = False
Application.DisplayAlerts = False

'data location & range to copy
mydata = "='F:\Sales\Forecasts\Maxine\[Cadspec 
Forecast.xlsm]Summary'!$Y$19:$Y$19"


'link to destination worksheet
'<< change as required
With ThisWorkbook.Worksheets(1).Range("$B$2")

    .Formula = mydata

    'convert formula to text
    .Value = .Value
    
End With
    
Application.DisplayAlerts = True

End Sub



"john" wrote:

> Steve,
> I rather suspect the Open Dialog is appearing because the filename in your 
> code cannot be found - Check your path & spelling is as it should be & try 
> again.
> -- 
> jb
> 
> 
> "Steve" wrote:
> 
> > Hi
> > 
> > I tried the following code from John which works OK except it brings up the 
> > open dialogue box. As sson as I select file and OK it poulates the cell in my 
> > master file.
> > 
> > Can I do it without going through the "Open Dialogue" box?
> > 
> > Private Sub CmdGetData_Click()
> > 
> > Dim mydata As String
> > 
> > 'data location & range to copy
> > '<< change as required
> > 'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
> > Forecast.xlsm]Summary'!$B$2:$B$2"
> > 
> > 'link to destination worksheet
> > '<< change as required
> > With ThisWorkbook.Worksheets(1).Range("B2:B2")
> >     .Formula = mydata
> > 
> >     'convert formula to text
> >     .Value = .Value
> >     
> > End With
> >     
> > 
> > End Sub
> > 
> > 
> > 
> > "john" wrote:
> > 
> > > Steve,
> > > you should be able to do this using formula without the need to open the file.
> > > 
> > > try following and see if it helps. Change file name \ folder \ worksheet 
> > > name as required
> > > 
> > > Sub GetData()
> > >     Dim mydata As String
> > >     
> > >     'data location & range to copy
> > >     '<< change as required
> > >     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > 
> > >     'link to destination worksheet
> > >     '<< change as required
> > >     With ThisWorkbook.Worksheets(1).Range("B2:F12")
> > >         .Formula = mydata
> > > 
> > >         'convert formula to text
> > >         .Value = .Value
> > >         
> > >     End With
> > >     
> > > End Sub
> > > -- 
> > > jb
> > > 
> > > 
> > > "Steve" wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I have a number of excel files that my sales team use for forecasting and it 
> > > > would be great to have a single file where I could pull in all the 
> > > > information to.
> > > > 
> > > > All the forecast sheets are the same so I know the cells that I want to pull 
> > > > in and I would even know the names.
> > > > 
> > > > I'm using Office 2007 with Vista.
> > > > 
> > > > Your help or guidance would be appreciated.
> > > > 
> > > > Thanks
> > > > 
> > > > Steve
0
Utf
11/23/2009 2:45:02 PM
Hi Steve,
on my simple test sheet - code returned values for both text & formula data.
Check your source sheet to ensure that cell contains value > 0 
Also, check the specified range for source sheet is the same for range on 
desination sheet.

eg Source Range B8:B12 Desination Range B8:B12

-- 
jb


"Steve" wrote:

> Hi John
> 
> I added the display alerts / ScreenUpdating and that seems to do the trick.
> 
> However, because the value I'm getting from the file is made up from a 
> formula, it rerturns £0.00. If I get a text value it works fine.
> 
> Any ideas?
> 
> Thanks
> 
> Steve
> 
> 
> 
> 
> Private Sub CmdGetData_Click()
> 
> Dim mydata As String
> 
> Application.ScreenUpdating = False
> Application.DisplayAlerts = False
> 
> 'data location & range to copy
> mydata = "='F:\Sales\Forecasts\Maxine\[Cadspec 
> Forecast.xlsm]Summary'!$Y$19:$Y$19"
> 
> 
> 'link to destination worksheet
> '<< change as required
> With ThisWorkbook.Worksheets(1).Range("$B$2")
> 
>     .Formula = mydata
> 
>     'convert formula to text
>     .Value = .Value
>     
> End With
>     
> Application.DisplayAlerts = True
> 
> End Sub
> 
> 
> 
> "john" wrote:
> 
> > Steve,
> > I rather suspect the Open Dialog is appearing because the filename in your 
> > code cannot be found - Check your path & spelling is as it should be & try 
> > again.
> > -- 
> > jb
> > 
> > 
> > "Steve" wrote:
> > 
> > > Hi
> > > 
> > > I tried the following code from John which works OK except it brings up the 
> > > open dialogue box. As sson as I select file and OK it poulates the cell in my 
> > > master file.
> > > 
> > > Can I do it without going through the "Open Dialogue" box?
> > > 
> > > Private Sub CmdGetData_Click()
> > > 
> > > Dim mydata As String
> > > 
> > > 'data location & range to copy
> > > '<< change as required
> > > 'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
> > > Forecast.xlsm]Summary'!$B$2:$B$2"
> > > 
> > > 'link to destination worksheet
> > > '<< change as required
> > > With ThisWorkbook.Worksheets(1).Range("B2:B2")
> > >     .Formula = mydata
> > > 
> > >     'convert formula to text
> > >     .Value = .Value
> > >     
> > > End With
> > >     
> > > 
> > > End Sub
> > > 
> > > 
> > > 
> > > "john" wrote:
> > > 
> > > > Steve,
> > > > you should be able to do this using formula without the need to open the file.
> > > > 
> > > > try following and see if it helps. Change file name \ folder \ worksheet 
> > > > name as required
> > > > 
> > > > Sub GetData()
> > > >     Dim mydata As String
> > > >     
> > > >     'data location & range to copy
> > > >     '<< change as required
> > > >     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > > 
> > > >     'link to destination worksheet
> > > >     '<< change as required
> > > >     With ThisWorkbook.Worksheets(1).Range("B2:F12")
> > > >         .Formula = mydata
> > > > 
> > > >         'convert formula to text
> > > >         .Value = .Value
> > > >         
> > > >     End With
> > > >     
> > > > End Sub
> > > > -- 
> > > > jb
> > > > 
> > > > 
> > > > "Steve" wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I have a number of excel files that my sales team use for forecasting and it 
> > > > > would be great to have a single file where I could pull in all the 
> > > > > information to.
> > > > > 
> > > > > All the forecast sheets are the same so I know the cells that I want to pull 
> > > > > in and I would even know the names.
> > > > > 
> > > > > I'm using Office 2007 with Vista.
> > > > > 
> > > > > Your help or guidance would be appreciated.
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > Steve
0
Utf
11/23/2009 3:01:02 PM
Thanks John

I have changed both yo "y19" now but still gives a 0 value. Should be 
£48,930.40

It seems to work OK when I have the file Open.

I thought we'd cracked it too!

Any other ideas welcome

Cheers

Steve





"john" wrote:

> Hi Steve,
> on my simple test sheet - code returned values for both text & formula data.
> Check your source sheet to ensure that cell contains value > 0 
> Also, check the specified range for source sheet is the same for range on 
> desination sheet.
> 
> eg Source Range B8:B12 Desination Range B8:B12
> 
> -- 
> jb
> 
> 
> "Steve" wrote:
> 
> > Hi John
> > 
> > I added the display alerts / ScreenUpdating and that seems to do the trick.
> > 
> > However, because the value I'm getting from the file is made up from a 
> > formula, it rerturns £0.00. If I get a text value it works fine.
> > 
> > Any ideas?
> > 
> > Thanks
> > 
> > Steve
> > 
> > 
> > 
> > 
> > Private Sub CmdGetData_Click()
> > 
> > Dim mydata As String
> > 
> > Application.ScreenUpdating = False
> > Application.DisplayAlerts = False
> > 
> > 'data location & range to copy
> > mydata = "='F:\Sales\Forecasts\Maxine\[Cadspec 
> > Forecast.xlsm]Summary'!$Y$19:$Y$19"
> > 
> > 
> > 'link to destination worksheet
> > '<< change as required
> > With ThisWorkbook.Worksheets(1).Range("$B$2")
> > 
> >     .Formula = mydata
> > 
> >     'convert formula to text
> >     .Value = .Value
> >     
> > End With
> >     
> > Application.DisplayAlerts = True
> > 
> > End Sub
> > 
> > 
> > 
> > "john" wrote:
> > 
> > > Steve,
> > > I rather suspect the Open Dialog is appearing because the filename in your 
> > > code cannot be found - Check your path & spelling is as it should be & try 
> > > again.
> > > -- 
> > > jb
> > > 
> > > 
> > > "Steve" wrote:
> > > 
> > > > Hi
> > > > 
> > > > I tried the following code from John which works OK except it brings up the 
> > > > open dialogue box. As sson as I select file and OK it poulates the cell in my 
> > > > master file.
> > > > 
> > > > Can I do it without going through the "Open Dialogue" box?
> > > > 
> > > > Private Sub CmdGetData_Click()
> > > > 
> > > > Dim mydata As String
> > > > 
> > > > 'data location & range to copy
> > > > '<< change as required
> > > > 'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > > mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
> > > > Forecast.xlsm]Summary'!$B$2:$B$2"
> > > > 
> > > > 'link to destination worksheet
> > > > '<< change as required
> > > > With ThisWorkbook.Worksheets(1).Range("B2:B2")
> > > >     .Formula = mydata
> > > > 
> > > >     'convert formula to text
> > > >     .Value = .Value
> > > >     
> > > > End With
> > > >     
> > > > 
> > > > End Sub
> > > > 
> > > > 
> > > > 
> > > > "john" wrote:
> > > > 
> > > > > Steve,
> > > > > you should be able to do this using formula without the need to open the file.
> > > > > 
> > > > > try following and see if it helps. Change file name \ folder \ worksheet 
> > > > > name as required
> > > > > 
> > > > > Sub GetData()
> > > > >     Dim mydata As String
> > > > >     
> > > > >     'data location & range to copy
> > > > >     '<< change as required
> > > > >     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > > > 
> > > > >     'link to destination worksheet
> > > > >     '<< change as required
> > > > >     With ThisWorkbook.Worksheets(1).Range("B2:F12")
> > > > >         .Formula = mydata
> > > > > 
> > > > >         'convert formula to text
> > > > >         .Value = .Value
> > > > >         
> > > > >     End With
> > > > >     
> > > > > End Sub
> > > > > -- 
> > > > > jb
> > > > > 
> > > > > 
> > > > > "Steve" wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I have a number of excel files that my sales team use for forecasting and it 
> > > > > > would be great to have a single file where I could pull in all the 
> > > > > > information to.
> > > > > > 
> > > > > > All the forecast sheets are the same so I know the cells that I want to pull 
> > > > > > in and I would even know the names.
> > > > > > 
> > > > > > I'm using Office 2007 with Vista.
> > > > > > 
> > > > > > Your help or guidance would be appreciated.
> > > > > > 
> > > > > > Thanks
> > > > > > 
> > > > > > Steve
0
Utf
11/23/2009 3:23:02 PM
Hi John

This is the code now.

Private Sub CmdGetData_Click()

Dim mydata As String

Application.ScreenUpdating = False
Application.DisplayAlerts = False

'data location & range to copy
mydata = "='F:\Sales\Forecasts\Maxine\[Cadspec 
Forecast.xlsm]Summary'!$Y$19:$Y$19"

'link to destination worksheet
With ThisWorkbook.Worksheets(1).Range("$Y$19")

    .Formula = mydata

    'convert formula to text
    .Value = .Value
    
End With
    
Application.DisplayAlerts = True

End Sub

"john" wrote:

> Hi Steve,
> on my simple test sheet - code returned values for both text & formula data.
> Check your source sheet to ensure that cell contains value > 0 
> Also, check the specified range for source sheet is the same for range on 
> desination sheet.
> 
> eg Source Range B8:B12 Desination Range B8:B12
> 
> -- 
> jb
> 
> 
> "Steve" wrote:
> 
> > Hi John
> > 
> > I added the display alerts / ScreenUpdating and that seems to do the trick.
> > 
> > However, because the value I'm getting from the file is made up from a 
> > formula, it rerturns £0.00. If I get a text value it works fine.
> > 
> > Any ideas?
> > 
> > Thanks
> > 
> > Steve
> > 
> > 
> > 
> > 
> > Private Sub CmdGetData_Click()
> > 
> > Dim mydata As String
> > 
> > Application.ScreenUpdating = False
> > Application.DisplayAlerts = False
> > 
> > 'data location & range to copy
> > mydata = "='F:\Sales\Forecasts\Maxine\[Cadspec 
> > Forecast.xlsm]Summary'!$Y$19:$Y$19"
> > 
> > 
> > 'link to destination worksheet
> > '<< change as required
> > With ThisWorkbook.Worksheets(1).Range("$B$2")
> > 
> >     .Formula = mydata
> > 
> >     'convert formula to text
> >     .Value = .Value
> >     
> > End With
> >     
> > Application.DisplayAlerts = True
> > 
> > End Sub
> > 
> > 
> > 
> > "john" wrote:
> > 
> > > Steve,
> > > I rather suspect the Open Dialog is appearing because the filename in your 
> > > code cannot be found - Check your path & spelling is as it should be & try 
> > > again.
> > > -- 
> > > jb
> > > 
> > > 
> > > "Steve" wrote:
> > > 
> > > > Hi
> > > > 
> > > > I tried the following code from John which works OK except it brings up the 
> > > > open dialogue box. As sson as I select file and OK it poulates the cell in my 
> > > > master file.
> > > > 
> > > > Can I do it without going through the "Open Dialogue" box?
> > > > 
> > > > Private Sub CmdGetData_Click()
> > > > 
> > > > Dim mydata As String
> > > > 
> > > > 'data location & range to copy
> > > > '<< change as required
> > > > 'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > > mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
> > > > Forecast.xlsm]Summary'!$B$2:$B$2"
> > > > 
> > > > 'link to destination worksheet
> > > > '<< change as required
> > > > With ThisWorkbook.Worksheets(1).Range("B2:B2")
> > > >     .Formula = mydata
> > > > 
> > > >     'convert formula to text
> > > >     .Value = .Value
> > > >     
> > > > End With
> > > >     
> > > > 
> > > > End Sub
> > > > 
> > > > 
> > > > 
> > > > "john" wrote:
> > > > 
> > > > > Steve,
> > > > > you should be able to do this using formula without the need to open the file.
> > > > > 
> > > > > try following and see if it helps. Change file name \ folder \ worksheet 
> > > > > name as required
> > > > > 
> > > > > Sub GetData()
> > > > >     Dim mydata As String
> > > > >     
> > > > >     'data location & range to copy
> > > > >     '<< change as required
> > > > >     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > > > 
> > > > >     'link to destination worksheet
> > > > >     '<< change as required
> > > > >     With ThisWorkbook.Worksheets(1).Range("B2:F12")
> > > > >         .Formula = mydata
> > > > > 
> > > > >         'convert formula to text
> > > > >         .Value = .Value
> > > > >         
> > > > >     End With
> > > > >     
> > > > > End Sub
> > > > > -- 
> > > > > jb
> > > > > 
> > > > > 
> > > > > "Steve" wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I have a number of excel files that my sales team use for forecasting and it 
> > > > > > would be great to have a single file where I could pull in all the 
> > > > > > information to.
> > > > > > 
> > > > > > All the forecast sheets are the same so I know the cells that I want to pull 
> > > > > > in and I would even know the names.
> > > > > > 
> > > > > > I'm using Office 2007 with Vista.
> > > > > > 
> > > > > > Your help or guidance would be appreciated.
> > > > > > 
> > > > > > Thanks
> > > > > > 
> > > > > > Steve
0
Utf
11/23/2009 3:25:02 PM
Hi Steve,
I am about to leave the office - all i can add is that code works fine for 
me in 2003 I note though that you are using 2007. Whilst i am not aware of 
any differences linking workbooks / sheets using formulas, there may well be 
a problem in 2007 with suggested approach & perhaps others can give you 
guidance.
-- 
jb


"Steve" wrote:

> Hi John
> 
> This is the code now.
> 
> Private Sub CmdGetData_Click()
> 
> Dim mydata As String
> 
> Application.ScreenUpdating = False
> Application.DisplayAlerts = False
> 
> 'data location & range to copy
> mydata = "='F:\Sales\Forecasts\Maxine\[Cadspec 
> Forecast.xlsm]Summary'!$Y$19:$Y$19"
> 
> 'link to destination worksheet
> With ThisWorkbook.Worksheets(1).Range("$Y$19")
> 
>     .Formula = mydata
> 
>     'convert formula to text
>     .Value = .Value
>     
> End With
>     
> Application.DisplayAlerts = True
> 
> End Sub
> 
> "john" wrote:
> 
> > Hi Steve,
> > on my simple test sheet - code returned values for both text & formula data.
> > Check your source sheet to ensure that cell contains value > 0 
> > Also, check the specified range for source sheet is the same for range on 
> > desination sheet.
> > 
> > eg Source Range B8:B12 Desination Range B8:B12
> > 
> > -- 
> > jb
> > 
> > 
> > "Steve" wrote:
> > 
> > > Hi John
> > > 
> > > I added the display alerts / ScreenUpdating and that seems to do the trick.
> > > 
> > > However, because the value I'm getting from the file is made up from a 
> > > formula, it rerturns £0.00. If I get a text value it works fine.
> > > 
> > > Any ideas?
> > > 
> > > Thanks
> > > 
> > > Steve
> > > 
> > > 
> > > 
> > > 
> > > Private Sub CmdGetData_Click()
> > > 
> > > Dim mydata As String
> > > 
> > > Application.ScreenUpdating = False
> > > Application.DisplayAlerts = False
> > > 
> > > 'data location & range to copy
> > > mydata = "='F:\Sales\Forecasts\Maxine\[Cadspec 
> > > Forecast.xlsm]Summary'!$Y$19:$Y$19"
> > > 
> > > 
> > > 'link to destination worksheet
> > > '<< change as required
> > > With ThisWorkbook.Worksheets(1).Range("$B$2")
> > > 
> > >     .Formula = mydata
> > > 
> > >     'convert formula to text
> > >     .Value = .Value
> > >     
> > > End With
> > >     
> > > Application.DisplayAlerts = True
> > > 
> > > End Sub
> > > 
> > > 
> > > 
> > > "john" wrote:
> > > 
> > > > Steve,
> > > > I rather suspect the Open Dialog is appearing because the filename in your 
> > > > code cannot be found - Check your path & spelling is as it should be & try 
> > > > again.
> > > > -- 
> > > > jb
> > > > 
> > > > 
> > > > "Steve" wrote:
> > > > 
> > > > > Hi
> > > > > 
> > > > > I tried the following code from John which works OK except it brings up the 
> > > > > open dialogue box. As sson as I select file and OK it poulates the cell in my 
> > > > > master file.
> > > > > 
> > > > > Can I do it without going through the "Open Dialogue" box?
> > > > > 
> > > > > Private Sub CmdGetData_Click()
> > > > > 
> > > > > Dim mydata As String
> > > > > 
> > > > > 'data location & range to copy
> > > > > '<< change as required
> > > > > 'mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > > > mydata = "='C:\Users\sreed\Documents\Personal\Excel\Forecast Test[Cadassist 
> > > > > Forecast.xlsm]Summary'!$B$2:$B$2"
> > > > > 
> > > > > 'link to destination worksheet
> > > > > '<< change as required
> > > > > With ThisWorkbook.Worksheets(1).Range("B2:B2")
> > > > >     .Formula = mydata
> > > > > 
> > > > >     'convert formula to text
> > > > >     .Value = .Value
> > > > >     
> > > > > End With
> > > > >     
> > > > > 
> > > > > End Sub
> > > > > 
> > > > > 
> > > > > 
> > > > > "john" wrote:
> > > > > 
> > > > > > Steve,
> > > > > > you should be able to do this using formula without the need to open the file.
> > > > > > 
> > > > > > try following and see if it helps. Change file name \ folder \ worksheet 
> > > > > > name as required
> > > > > > 
> > > > > > Sub GetData()
> > > > > >     Dim mydata As String
> > > > > >     
> > > > > >     'data location & range to copy
> > > > > >     '<< change as required
> > > > > >     mydata = "='C:\[Mybook.xls]Sheet1'!$B$2:$F$12"
> > > > > > 
> > > > > >     'link to destination worksheet
> > > > > >     '<< change as required
> > > > > >     With ThisWorkbook.Worksheets(1).Range("B2:F12")
> > > > > >         .Formula = mydata
> > > > > > 
> > > > > >         'convert formula to text
> > > > > >         .Value = .Value
> > > > > >         
> > > > > >     End With
> > > > > >     
> > > > > > End Sub
> > > > > > -- 
> > > > > > jb
> > > > > > 
> > > > > > 
> > > > > > "Steve" wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I have a number of excel files that my sales team use for forecasting and it 
> > > > > > > would be great to have a single file where I could pull in all the 
> > > > > > > information to.
> > > > > > > 
> > > > > > > All the forecast sheets are the same so I know the cells that I want to pull 
> > > > > > > in and I would even know the names.
> > > > > > > 
> > > > > > > I'm using Office 2007 with Vista.
> > > > > > > 
> > > > > > > Your help or guidance would be appreciated.
> > > > > > > 
> > > > > > > Thanks
> > > > > > > 
> > > > > > > Steve
0
Utf
11/23/2009 3:55:02 PM
See also
http://www.rondebruin.nl/ado.htm

-- 

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Steve" <Steve@discussions.microsoft.com> wrote in message news:18216447-42B4-4AB2-97A0-1590E3AFD7AF@microsoft.com...
> Thanks John
> 
> I will give this a go and see how I get on.
> 
> It would be ideal if i could do it without having them open.
> 
> Appreciate you help
> 
> Steve
> 
> "Steve" wrote:
> 
>> Hi,
>> 
>> I have a number of excel files that my sales team use for forecasting and it 
>> would be great to have a single file where I could pull in all the 
>> information to.
>> 
>> All the forecast sheets are the same so I know the cells that I want to pull 
>> in and I would even know the names.
>> 
>> I'm using Office 2007 with Vista.
>> 
>> Your help or guidance would be appreciated.
>> 
>> Thanks
>> 
>> Steve
0
Ron
11/23/2009 6:54:47 PM
Reply:

Similar Artilces:

Reflecting info between an excel file and a word one or two excel file.
I have an Excel file that I use as a database with the dates of the time when my company does the maintenance of our electronics tools (we work in an industry that uses them a lot, we have around 200 in an Excel file). So the documents look as follows (the images are copied and edited in paint, that's why they look kinda weird). They are next to each other; I divided it here in order to fit it to word's format (it's in Spanish, there's no need for you to understand what it says anyway): Go to www.caladeamerica.com.ar/1st file.jpg please and see it. We do the maintenance of...

i get error 404 not found when trying to download
I'm trying to download nokia pc suite to windows xp to upload gallery onto the computer but get error message404 not found - how can i download this pc suite please -- Krysy Albutt Krysy Albutt wrote: > I'm trying to download nokia pc suite to windows xp to upload gallery > onto the computer but get error message404 not found - how can i > download this pc suite please Care to enlighten us how this pertains to: - 1) Microsoft 2) Publisher 3) Windows If you're having problems downloading from the *NOKIA* site where do you think you should be directing your ...

How do I import a WORD file into EXCEL? #2
I'd like to import a WORD table to Excel but when I go to "Select Data Source", only other EXCEL files show, not my WORD files but the Help function indicates that all files should be showing. I've selected "Text Files" from the Data Source; I've tried "All File Types" with no luck. Anybody have a clue for me? ..signed, an Excel Idiot......thanks! File>open and select all files or copy and paste -- Regards, Peo Sjoblom "MauiMama" <MauiMama@discussions.microsoft.com> wrote in message news:27741FDC-23BA-478D-98AC-21760...

How to get Calendar to send me reminders
I have changed my e-mail address but for some reason I cannot get Calendar to send reminders to my new address - I think I have carried out all that is necessary to effect the changover but I am not getting reminders sent. Can anyone help please? Is the Calendar Live ID based and accessible at Calendar.live.com ? -- ....winston ms-mvp mail "Dabardevon" wrote in message = news:FDC2B3B2-EDE4-41B1-BFC4-C0F9ED59CFB9@microsoft.com... I have changed my e-mail address but for some reason I cannot get = Calendar to send reminders to my new address - I think I have...

Some recipients get the attachment, some get winmail.dat
This one has me baffled. We are using Exchange 2000 and Outlook 2000 and have been for 8 months. No previous problems with attachments (.doc, .xls, .jpg). About 2 weeks ago, we started hearing from certain recipients that the attachment wasn't arriving; instead they were getting an unreadable file called winmail.dat. MS says that this is because the sender is using Rich Text to format the email. We have changed the senders to use Plain Text and still have the same problem. If the email is sent to several recipients, some will get the attachment fine, some will not. This didn'...

Conditional linked files
Hi, I have two files (a master and a detail) in which I pull through a column from the detail to the master, using "=[Detail.xls]Sheet1!$A$2" However I would like to configure the spreadsheets so that only data which meets a condition is pulled in the master, in other words using pseudo code as follows. If [link] in detail.xls = yes then display in master. I realise that the condition statement will probably need to sit in the master file but have no idea how this is done or whether possible at all. Any ideas? Mark -- madiba --------------------------------------------------...

How to get the CScrollBar's Handle in CTreeCtrl?
Hey,All: I thought I have a problem when I trid to get the CScrollBar's handle from my CTreeCtrl extended handle. Can anybody tell me whether I can get the handle of the CScrollBar from the CTreeCtrl? Thanks in advance! Carl :-| Carl wrote: > Hey,All: > > I thought I have a problem when I trid to get the CScrollBar's handle from > my CTreeCtrl extended handle. > Can anybody tell me whether I can get the handle of the CScrollBar from the > CTreeCtrl? > > Thanks in advance! > Carl > :-| > > Sorry, it is not that simple. The scroll bars that...

Same file exists when I run Optimizer
Dear Sir/Madam, While I was running the Optimizer to utilize free space I met a error message during moving the files C:\exchsrvr\imcdata into D:\exchsrver\imcdata " There is the same file, ...., in the destination.". But I could see for sure that there was No files in the destination. Could you let me know how to fix it? Thanks a lot in advance. KC "�̱�ö" <kclee@jcsworld.com> wrote: >While I was running the Optimizer to utilize free space I met a error >message during moving the files C:\exchsrvr\imcdata into >D:\exchsrver\imcdata " There is...

A Crystal Beginner
I am using Crystal 9.2.4.77 and have loaded the Crystal enhancements. Now I want to do against the CRM database. What do I do? I thought I would create a data source to the CRM SQLserver, which I did, then connect to it through Crystal Reports. That works, but when I drill down on the AAA_MSCRM database to choose my tables, it shows me dbo as the only option (where did this come from??) and under that are just a few generic tables. No CRM tables. Something's not quite right. What am I missing? file - log on to aps server "KBLawson" <klawson@aetinc.com> wrote in ...

file is locked does not appear in Excel if file already open by an
We have shared files on a network drive. When a file is open by one user, and a second user opens the file we want them to recieve <filename> is locked for editing message and open the file read only. This works great for some users, but we have several users that can open the file (even if someone is already in it) and they do not get the prompt and can edit the workbook. Is there a setting that would turn this off for some users and not others in excel? Hello Leslie, You could try sharing the workbook. With the Excel workbook open, choose Tools from the menu. Choose Share W...

Cannot get fast forward or fast reverse to work with WMP 11
I am running Vista Home Premium on a HP G 217-EM Notebook which comes pre-installed with Windows Media Player 11. When I play cds and try to fast forward or fast reverse by keeping the fast forward or fast reverse buttons constantly depressed nothing happens. Why is this, and can anyone come up with a solution? Many thanks This doesn't work on my system either, so it's probably just a limitation of WMP. Fast forward and fast reverse should work fine when you rip the CD's to MP3 or WMA files, and play these files instead. Regards -- Tim De Baets http://www....

Outlook won't close
I'm running Outlook2000 under WinXP and when I close Outlook it either hangs in memoey and continues to run or the mail icon stays up in the taskbar. I then have to open the task manager and kill it there. I've installed the latest Office service packs and searched the knowlege base but cannot find a similar problem posted. I believe I've had this problem as far back as the Win98 days. Anyone have an idea how i can fix this? I'm betting it's just taking so long you're assuming it's locked when it's simply taking a long time. I assume when you close it i...

Excel VBA / Data Sorting / Maniputaltion
i have a long list, which i imported from other data base. The problem is: 1. In each cell, besides data (data is in alphabates) there are som numeric characters which i dont want . How can i get rid of all those unwanted numbers from data, from all th list? 2. The data is in every second row, ie. one row is empty. How can i Delete those empty/blank rows from the list -- Message posted from http://www.ExcelForum.com 1. I think we will need to see a sample of your data 2. Sort the data -- Message posted from http://www.ExcelForum.com I am sending the sample data file... ...

I can not open doc file attachments from outlook express 6.0
I can not open doc file attachments in outlook express 6.0 Error message - There is not enough memory to open file All other attachments eg: jpeg etc are fine I have already increased my paging memory. >-----Original Message----- >I can not open doc file attachments in outlook express 6.0 >Error message - There is not enough memory to open file >All other attachments eg: jpeg etc are fine=20 >I have already increased my paging memory. >. > These Newsgroups address Office Outlook issues. Outlook Express gurus hang out here: http://communities.microsoft.com/newsgroups/def...

Get paid while you get online!!
I found a great Internet company - Cashfiesta.com - that has created a product everyone can benefit from. They pay you while you work or play on your computer. All you need to do is keep their software - the FiestaBar=99 - active while you are online. They even pay you when your friends are using their computers. Unlike other companies, Cashfiesta gives you control over how much money you earn. They have an individual payrate based on the number of Special Offers you sign up for. As some of these offers are free, you can increase your payrate up to 33 times without spending a penny. It's...

Spreadsheet getting corrupted
Hello All: I have a relatively large spreadsheet. I am getting errors (see after my signature line). What could be causing these errors? Is it that the spreadsheet is too large? Thanks Deguza -------------------------------------------------------- Microsoft Office Excel File Repair Log Errors were detected in file 'C:\Documents and Settings\deguza\My Documents\sales\Sales_2006_2007.xls' The following is a list of repairs: Global PivotTable report information was repaired due to integrity problems. Global PivotTable report information was repaired due to integrity problems. Glo...

Change Excel Icon
Is there any way that the Excel Icon can be changed (without creating a shotcut) but still open as an excel application when clicked? Many Thanks. Kevin. Right click the icon, go to properties, select Change Icon. "kevin" <kevin@discussions.microsoft.com> wrote in message news:BD3D14AE-46DA-4D03-944F-B04BF1DA0D8C@microsoft.com... > Is there any way that the Excel Icon can be changed (without creating a > shotcut) but still open as an excel application when clicked? > > Many Thanks. > > Kevin. Kevin AFAIK you cannot change the icon for the Excel.exe...

Converting Outlook files #2
Hi, In a magazine article that I read, it said that when moving from Outlook 2002 or earlier to Outlook 2003, you should convert the file to the new format that is found in 2003, but how can I do that BTW. I don't want to loose all of the documents and setting that are already associated with the current file -- Thank you in Advance Merci a l'Avance Martin In Outlook 2003, File->New->Outlook Data File->Type->Personal Folders File. Do not select the 97-2002 format. Then drag and drop your folders from the old to the new. --� Milly Staples [MVP - Outlook] Post...

How to program an excel macro to repeat a series of keystrokes?
I want to program an Excel macro to set a columnar range, then perform the keystroke series "F2, Home, =, Enter" repeatedly until the end of the range is reached. How do I teach the macro to automatically repeat the keystoke series? I am using XP, and Excel 2002 10.4. Thanks for your help!!! Hi there, Look up Sendkeys in the visual basic editor help. Hope that helps Naz, London "Beancounter" wrote: > I want to program an Excel macro to set a columnar range, then perform the > keystroke series "F2, Home, =, Enter" repeatedly until the end of the ...

Can't get auto-update (update) to install
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Power PC I've been trying to manually check for updates to Word 2008, and I get a &quot;critical update&quot; notice, asking me to install auto-update. When I try to install it, I cannot. It just keeps repeating the attempt, in an &quot;endless loop.&quot; What to do? <br> Thank you. ...

Checking specific text string in excel files stored in a folder
Hi, I need to write a code that can do the following: 1) prompt user to select a particular folder 2) search for a particular text string, for e.g., ABCD in all the excel files in that folder (the number of files in the folder will vary and so does the names of the files). Is it possible to specify the string that we want to search on the fly when macro is run? 3) create a simple report that contains the filename in one column and yes / no in the second column that tell me which file names contain that keyword (it will be great if the path of the file can be recorded in the 3rd colum...

Reg getting the next IV Document Number field !
Hi, I am creating a window in dexterity similar to the item transaction entry window (Transactions>Inventory> Transaction Entry). In the Item transaction Entry window, the Document number field defaults to the next document number when we move the focus to that field. I wanted to know if there is any function , or table that i can access to get the next document number in the new window that i am creating. Thanks, swetha -- swetha >In the Item transaction Entry window, the Document number field defaults to the next document number when we move the focus to that field.< T...

Footers/Headers in Excel
Can I paste from Word to a custom header or footer in Excel? Yes. Select what you want in Word and copy. Go to custom header spot. You need to click in there and hit ctrl;v There's no command to actually paste (like right clicking). ctrl;c = copy ctrl;v = paste "sls" wrote: > Can I paste from Word to a custom header or footer in Excel? ...

Get notified when Out of Office is on
I am using Outlook 2007. With 2003, when returning from leave, I used to get a notification that the Outlook out of office was still on and asking me if I wanted to switch it off. This reminder no longer appears with 2007. How can I switch this setting on so that I get the notification? "Mary Ann" <MaryAnn@discussions.microsoft.com> wrote in message news:ED5533A7-D0EA-41B8-B1A0-A9D15FB6FD98@microsoft.com... >I am using Outlook 2007. With 2003, when returning from leave, I used to get > a notification that the Outlook out of office was still on and asking me ...

How to export fixed length records to a data file.
I'm creating a query for our school using the school district's standard student data format. All fields are fixed width. For example the WhiteEthnicFg field is exactly one character of either "Y" or "N". In our database we record that field as a Boolean. The Date-of-Birth District's field is an 8 character field in the format mmddyyyy. Most fields are fixed width 'Char' fields, but I don't know how to make the output match the correct width. There are decimal fields 'with one implied decimal point'. Example: 0000100 will result ...