How can I be sure that I can access to Filename.xls from VBA

zoki

New Member
Joined
May 11, 2005
Messages
7
Problem is:
I export some data from another program to excel, and after that exporting code I try to show that created Filename.xls , but sometimes (when I export a big file) I accept message from excel " Cannot Access Filename.xls".
In App.xla in excel I have code which format data in Filename.xls, and start automatcly when Filename.xls is opened.

I think that problem is in speed writing data in memory (excel), because when i export small file evruthing works ok.

Is there any possibility to find out (from xla, vba) when writting is finished, and then to access to Filename.xls to format data

thanks
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

zoki

New Member
Joined
May 11, 2005
Messages
7
File exists allways

how it works :
When I export new data I overwrite old file,
also I cannot find what exactly mean message "Cannot access Filename.xls" from excel, when I clicked OK nothing happens, only excel was oppened...
help
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
How are you exporting the data? Can you delete the existing file and recreate it rather than overwriting it?

If you post your code, we may be able to find another way of waiting until the file is available to Excel.
 

zoki

New Member
Joined
May 11, 2005
Messages
7
The program is writing in Delphi,

and I use ADO component to export data. Delphi code is not a problem I THINK that prob. is in speed but mabye I'wrong, I'm not sure.
The fact is: when I test it on slower machine it works OK.

I also tried in Delphi with Sleep (number in milisec) function to stop executing code for some time but no reults.


:-> I repeat I'm not sure about reason of apearing that messsage. :rolleyes:

In xla I check name of xls files which opened and when I find name: Filename.xls I start formating it' simple. :roll
 

Watch MrExcel Video

Forum statistics

Threads
1,118,436
Messages
5,572,107
Members
412,441
Latest member
kelethymos
Top