View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Guenter Guenter is offline
external usenet poster
 
Posts: 5
Default Inexplicable crash in VBA

Hello,

Thx for the input. I checked out the link but it looks like the fso is only
for VB 6. it doesn't seem to be available with Excel VBA (and I need this
thing to be backwards compatible through Excel 97 . . .)

gk

"CoRrRan" wrote:

"?B?R3VlbnRlcg==?=" wrote
in :

We ship a small Excel VBA application with our Time Reporting
Terminal. About 150 have been installed without a hitch - as far
as I know under all past and present versions of Excel. In ONE
particular case (which unfortunately happens to be the french
government) the instruction :

OPEN Text_File_Name FOR OUTPUT AS #n

causes the code to terminate WITHOUT ANY SORT OF ERROR MESSAGE
(behaves just like an END statement). This happens in normal RUN
mode as well as in Step-by-Step Debug mode. Obviously since none
of the code following the statement is ever executed the
application does not work.

The same error occurs with "APPEND". However, "OPEN FOR INPUT"
works correctly.

The environment is Excel 2000 under XP. The directory referenced
exists and is accessible (I can create a text file in the
directory with WordPad). The error occurs whether the file already
exists or not. The Anti-Virus program on the PC concerned
(Kaspersky) was turned off - no difference. The same error occurs
on another PC at the same site with identical configuration.

I'm getting desperate - has anybody out there encountered a
similar situation? I would be very grateful for any sort of help
on this!


I can't explain why this is happening, but I have a suggestion.
Instead of using "OPEN Text_File_Name FOR OUTPUT AS #n" you could
have a look at the FileSystemObject:

http://tinyurl.com/4goza (<--linked to MSDN)

The FileSystemObject can perform all the functions that you can do
with the "OPEN"-statement.

I know it is not a direct solution to your problem, but perhaps you
can make the application work for the party concerned...

HTH,

CoRrRan