Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Copying data from a network file - many problems

Hi,

I have an excel workbook which the user updates once a week by
pressing a "synchronise" button.

This calls some code which opens a shared file on a network, filters
the (60000+) records on the sheet and copies the filtered records
(approx 3000) back into the original workbook.

Problems -

Too many people trying to "synchronise" at the same time can cause the
"synchronise" process to take up to half an hour. Even with only 1
person trying the access the file the network is slow and can take 5 -
10 mins.

I therefore figured my solution would be to use ADO (new to me but I
did some research) to copy a named range without opening the file (on
the presumption that lots of people would be able to do this at once,
and if the code was not having to physically open the file it would
speed it up). I thought instead of filtering I would just copy ALL of
the data from the file and bring it back to my workbook,then filter it
in place.

I used code from rondebruin.

It works excellently if I use a small range - however there are 60000+
rows of data in the file that I need to copy and it fails seemingly
because the range is too large.

My thoughts;

Can I filter the workbook without opening it to only copy the required
range? Or is there a way I can copy all of the data without it
failing.

Many thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Copying data from a network file - many problems

How is the ADO recordSet opened?

You can use such SQL statement to filter out unwanted records:

MyRecordSet.Opne "SELECT Col1, Col2... FROM [Range]$ WHERE col1=....",
connectionString,...

As long as you define the condition in "WHERE" clause fine enough, you could
only retrieve the records you need, not whole 60000 each time.


"keri" wrote in message
ups.com...
Hi,

I have an excel workbook which the user updates once a week by
pressing a "synchronise" button.

This calls some code which opens a shared file on a network, filters
the (60000+) records on the sheet and copies the filtered records
(approx 3000) back into the original workbook.

Problems -

Too many people trying to "synchronise" at the same time can cause the
"synchronise" process to take up to half an hour. Even with only 1
person trying the access the file the network is slow and can take 5 -
10 mins.

I therefore figured my solution would be to use ADO (new to me but I
did some research) to copy a named range without opening the file (on
the presumption that lots of people would be able to do this at once,
and if the code was not having to physically open the file it would
speed it up). I thought instead of filtering I would just copy ALL of
the data from the file and bring it back to my workbook,then filter it
in place.

I used code from rondebruin.

It works excellently if I use a small range - however there are 60000+
rows of data in the file that I need to copy and it fails seemingly
because the range is too large.

My thoughts;

Can I filter the workbook without opening it to only copy the required
range? Or is there a way I can copy all of the data without it
failing.

Many thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Copying data from a network file - many problems

My code (or not at all mine - thanks to ron)

(obviously the path in this first sub isn't correct - nor the range I
am trying to get - "a1:s5000" should be "a1:s60000" but obviously I
can't do that. I would want to filter the dourcerange by column C
(value to equal 0804).

Sub File_in_network_folder()
getrange("C:\documents and settings\here
\desktop","south.xls","south","a1:s5000",sheets("s heet4").range("a1")
end sub

Sub GetRange(FilePath as String, FileName as String, SheetName as
String, SourceRange as String, DestRange as Range)

Dim start
Application.Goto.DestRange
Set DestRange =
DestRange.Resize(Range(SourceRange).Rows.Count,Ran ge(SourceRange).Columns.Count)

With DestRange
.FormulaArray = "='" & FilePath & "/[" & FileName & "]" & SheetName
& "'!" & SourceRange

Start = Timer
Do While Timer < Start + 2
DoEvents
Loop

..copy
..PasteSpecial xlPasteValues
..Cells(1).select
Application.CutCopyMode = False
End With
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying data from a network file - many problems

Hi Keri

If you remove this part do you have the same problem then

Start = Timer
Do While Timer < Start + 2
DoEvents
Loop

.copy
.PasteSpecial xlPasteValues
.Cells(1).select
Application.CutCopyMode = False



Why not open the file for a big range
You can use code to do this ?



--

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


"keri" wrote in message ups.com...
My code (or not at all mine - thanks to ron)

(obviously the path in this first sub isn't correct - nor the range I
am trying to get - "a1:s5000" should be "a1:s60000" but obviously I
can't do that. I would want to filter the dourcerange by column C
(value to equal 0804).

Sub File_in_network_folder()
getrange("C:\documents and settings\here
\desktop","south.xls","south","a1:s5000",sheets("s heet4").range("a1")
end sub

Sub GetRange(FilePath as String, FileName as String, SheetName as
String, SourceRange as String, DestRange as Range)

Dim start
Application.Goto.DestRange
Set DestRange =
DestRange.Resize(Range(SourceRange).Rows.Count,Ran ge(SourceRange).Columns.Count)

With DestRange
.FormulaArray = "='" & FilePath & "/[" & FileName & "]" & SheetName
& "'!" & SourceRange

Start = Timer
Do While Timer < Start + 2
DoEvents
Loop

.copy
.PasteSpecial xlPasteValues
.Cells(1).select
Application.CutCopyMode = False
End With
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Copying data from a network file - many problems

I still have the same problem if I remove that part.

Opening the file is the problem as many people are accessing at the
same time and the time it takes can be up to half an hour to open the
file, filter the data and copy the filtered range which is what I was
doing.

I'm trying everything as this is V urgent, i'm now working on
microsoft query but cannot seem to pass variables for the path and
filename to it.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying data from a network file - many problems

Have you try ADO
http://www.rondebruin.nl/ado.htm


--

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


"keri" wrote in message oups.com...
I still have the same problem if I remove that part.

Opening the file is the problem as many people are accessing at the
same time and the time it takes can be up to half an hour to open the
file, filter the data and copy the filtered range which is what I was
doing.

I'm trying everything as this is V urgent, i'm now working on
microsoft query but cannot seem to pass variables for the path and
filename to it.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Copying data from a network file - many problems

Where is the code using ADO, as you mentioned in previous post?


"keri" wrote in message
ups.com...
My code (or not at all mine - thanks to ron)

(obviously the path in this first sub isn't correct - nor the range I
am trying to get - "a1:s5000" should be "a1:s60000" but obviously I
can't do that. I would want to filter the dourcerange by column C
(value to equal 0804).

Sub File_in_network_folder()
getrange("C:\documents and settings\here
\desktop","south.xls","south","a1:s5000",sheets("s heet4").range("a1")
end sub

Sub GetRange(FilePath as String, FileName as String, SheetName as
String, SourceRange as String, DestRange as Range)

Dim start
Application.Goto.DestRange
Set DestRange =
DestRange.Resize(Range(SourceRange).Rows.Count,Ran ge(SourceRange).Columns.Count)

With DestRange
.FormulaArray = "='" & FilePath & "/[" & FileName & "]" & SheetName
& "'!" & SourceRange

Start = Timer
Do While Timer < Start + 2
DoEvents
Loop

.copy
.PasteSpecial xlPasteValues
.Cells(1).select
Application.CutCopyMode = False
End With
End Sub



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
Problems copying Large Amounts of Data in Excel 2007 Jeff Lowenstein Excel Discussion (Misc queries) 1 April 14th 08 08:24 PM
Best practices for pulling data from a network Excel file (mult users) KR Excel Programming 0 March 7th 06 07:40 PM
Problems copying XLA file Trefor Excel Discussion (Misc queries) 3 November 28th 05 04:04 PM
Copying Data across a network or internet Battle Brown Excel Programming 0 December 3rd 03 06:38 PM
Copying files ...Network to Network Eric[_6_] Excel Programming 2 July 18th 03 08:59 PM


All times are GMT +1. The time now is 11:10 AM.

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

About Us

"It's about Microsoft Excel"