VBA error with Open for Output / Append: File not Found

M

MikeKim

Hi all,

I'm having a very wierd error with my MS Excel VBA coding. I have a
macro that gets caught on the line

Open "C:\{filename}" for Append as #2

It throws the error, "file not found" during runtime. I'm confused for
2 reasons: 1: Append should create the file if it wasn't found,
shouldn't it? and 2: this exact same macro works on other machines
that as far as i can tell are identical. Both are running the same
Excel version (2002 SP3), both XP Pro, and same antivirus (Kaspersky)
as well. I've been trying for a couple days on and off to try to
figure out the problem, and have come up with nada. I found a previous
post that sounds similar here:

http://groups.google.com/group/micr...for+Append+text&rnum=1&hl=en#d80e3b8399774704

Does anyone know of a glitch in VBA that makes the Open command work
sometimes and not others? or is there some windows setting that
affects it's ability to create a file? it just doesn't make any sense
to me! Help!

Thanks to any and all,
-Michael
 
M

MikeKim

I found the problem. I turned out to be AntiVirus Software related -
which is why it worked on some machines but not others. The AV
software we're using is Kaspersky (which is also what the other user
was using in the thread linked to in my original post). I'd tested out
the AV by disabling it, but that didn't fix it. However, for some
reason, when I change the Real-Time settings for Kaspersky to
High-Speed, the Macro should work correctly. easy, and so annoying
fix. After the setting change, I was also able to keep kaspersky
enabled while running the excel macro. Open for Append works fine now
in creating and deleting the files.

-Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top