Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Slow Network

Hi,
I have this code
' Load Three sheets
iFilesUsedCounter = 0
Do While iFilesUsedCounter < 9
' Open AFMA WorkBook
sFileName = AFMAFiles(iFileCounter).sFileName
ActiveWorkbook.Save 'Close and save Averaging file
Workbooks.Open sAFMAPathName & sFileName
iFilesUsedCounter = iFilesUsedCounter + 3
Windows(sFileName).Activate
Application.CutCopyMode = False 'Clear Clipboard
ActiveWindow.Close SaveChanges:=False 'Close without saving AFMA file
iFileCounter = iFileCounter - 1
Loop

Which works on a good day. If the network is running slow is get a 'Unable
to Open file' or 'The file is corrupt & Cannot be opened'

Is their a way to check if the file is fully open before closing it and
checking if the file is fully closed before opening the next one

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default Slow Network

I'm not sure if this will work or not - but when you close the active window,
the name of the active window is going to change. So you may be able to use
code like this after the .Close statement (2nd from last)
Do While ActiveWorkbook.Name = sFileName
DoEvents
Loop



"MarkS" wrote:

Hi,
I have this code
' Load Three sheets
iFilesUsedCounter = 0
Do While iFilesUsedCounter < 9
' Open AFMA WorkBook
sFileName = AFMAFiles(iFileCounter).sFileName
ActiveWorkbook.Save 'Close and save Averaging file
Workbooks.Open sAFMAPathName & sFileName
iFilesUsedCounter = iFilesUsedCounter + 3
Windows(sFileName).Activate
Application.CutCopyMode = False 'Clear Clipboard
ActiveWindow.Close SaveChanges:=False 'Close without saving AFMA file
iFileCounter = iFileCounter - 1
Loop

Which works on a good day. If the network is running slow is get a 'Unable
to Open file' or 'The file is corrupt & Cannot be opened'

Is their a way to check if the file is fully open before closing it and
checking if the file is fully closed before opening the next one

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Slow Network

Hi

been having lots of other problems, but I've got back to it. I've added this
to the code

' Close WorkBook with out saveing
Windows(sFileName).Activate
Application.CutCopyMode = False 'Clear Clipboard
Do While ActiveWorkbook.Name < sFileName
DoEvents
Loop
ActiveWindow.Close SaveChanges:=False
Do While ActiveWorkbook.Name < ThisWorkbook.Name
DoEvents
Loop
' Update pointers
iFilesUsedCounter = iFilesUsedCounter + 1
iFileCounter = iFileCounter - 1

And it has fixed my problem

Thanks MarkS


"JLatham" wrote:

I'm not sure if this will work or not - but when you close the active window,
the name of the active window is going to change. So you may be able to use
code like this after the .Close statement (2nd from last)
Do While ActiveWorkbook.Name = sFileName
DoEvents
Loop



"MarkS" wrote:

Hi,
I have this code
' Load Three sheets
iFilesUsedCounter = 0
Do While iFilesUsedCounter < 9
' Open AFMA WorkBook
sFileName = AFMAFiles(iFileCounter).sFileName
ActiveWorkbook.Save 'Close and save Averaging file
Workbooks.Open sAFMAPathName & sFileName
iFilesUsedCounter = iFilesUsedCounter + 3
Windows(sFileName).Activate
Application.CutCopyMode = False 'Clear Clipboard
ActiveWindow.Close SaveChanges:=False 'Close without saving AFMA file
iFileCounter = iFileCounter - 1
Loop

Which works on a good day. If the network is running slow is get a 'Unable
to Open file' or 'The file is corrupt & Cannot be opened'

Is their a way to check if the file is fully open before closing it and
checking if the file is fully closed before opening the next one

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default Slow Network

Glad it's working for you now. Your solution also brings to mind another
possible way of doing it: you could count the number of workbooks that are
open (use Workbooks.Count) before doing the save/close and use a Do While
loop that loops until Workbooks.Count < equal the earlier number. Often
there are several ways to accomplish a task in Excel.

"MarkS" wrote:

Hi

been having lots of other problems, but I've got back to it. I've added this
to the code

' Close WorkBook with out saveing
Windows(sFileName).Activate
Application.CutCopyMode = False 'Clear Clipboard
Do While ActiveWorkbook.Name < sFileName
DoEvents
Loop
ActiveWindow.Close SaveChanges:=False
Do While ActiveWorkbook.Name < ThisWorkbook.Name
DoEvents
Loop
' Update pointers
iFilesUsedCounter = iFilesUsedCounter + 1
iFileCounter = iFileCounter - 1

And it has fixed my problem

Thanks MarkS


"JLatham" wrote:

I'm not sure if this will work or not - but when you close the active window,
the name of the active window is going to change. So you may be able to use
code like this after the .Close statement (2nd from last)
Do While ActiveWorkbook.Name = sFileName
DoEvents
Loop



"MarkS" wrote:

Hi,
I have this code
' Load Three sheets
iFilesUsedCounter = 0
Do While iFilesUsedCounter < 9
' Open AFMA WorkBook
sFileName = AFMAFiles(iFileCounter).sFileName
ActiveWorkbook.Save 'Close and save Averaging file
Workbooks.Open sAFMAPathName & sFileName
iFilesUsedCounter = iFilesUsedCounter + 3
Windows(sFileName).Activate
Application.CutCopyMode = False 'Clear Clipboard
ActiveWindow.Close SaveChanges:=False 'Close without saving AFMA file
iFileCounter = iFileCounter - 1
Loop

Which works on a good day. If the network is running slow is get a 'Unable
to Open file' or 'The file is corrupt & Cannot be opened'

Is their a way to check if the file is fully open before closing it and
checking if the file is fully closed before opening the next one

Thanks

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
EXCEL SLOW - USING NETWORK ON SELECT FUNCTIONS RONMAN101 Excel Discussion (Misc queries) 0 September 27th 08 02:41 PM
Excel slow to save to network drive Chris Excel Discussion (Misc queries) 1 May 8th 08 09:43 PM
How to speed up slow network access in office 2003 LeanneW Excel Discussion (Misc queries) 0 February 22nd 08 01:16 AM
Opening files from Network resource extremely slow LTCol Excel Discussion (Misc queries) 0 November 30th 07 07:05 PM
Excel Slow saving across Network. David Jenkins Toppan Excel Discussion (Misc queries) 0 November 14th 06 09:02 PM


All times are GMT +1. The time now is 10:50 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"