View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Eric Eric is offline
external usenet poster
 
Posts: 1,670
Default Does loop function cause this problem?

Once I use the loop function for following codes, I run into problems on
files, such as
1) All files can be read and written in the first place, but somehow I don't
understand why some file type becomes read only. Does the loop cause any
problem by retrieving data too quick while saving and closing processes do
not complete?

2) date from Data file could be retrieved by other application at the same
time, so I set the displayalert to be false, but DisplayAlerts is still pop
up for locating the Data file, any suggestions on what cause this problem?

Does anyone have any suggestions on how to solve this loop problem?
Thank in advance for any suggestions
Eric
-------------------------------------------------------------------------------------
Application.DisplayAlerts = False
{Retrieve the latest date in cell A2 from file Data.xls}
x = TheValue("E:\Files", "Data.xls", "Records", "A2")

[Repeated codes - start]
Do
{Summary file must be opened at least once}
Workbooks.Open Filename:="E:\Files\Summary.xls", UpdateLinks:=3
Workbooks("Summary.xls").Close savechanges:=True
{Retrieve the last updated date in cell A591 from file Summary.xls}
y = TheValue("E:\Files", "Summary.xls", "Records", "A591")
{If the date is different between Data and Summary files, then redo this
step again}
Loop While x < y
[Repeated codes - end]

{This repeated codes will be duplicated 64 times for different files to be
updated}
-------------------------------------------------------------------------------------