Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

file open antivirus conflict

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » File Open Antivirus Conflict, File Save Antivirus Conflict

File Open Antivirus Conflict, File Save Antivirus Conflict

ResolvedVersion 2007

Mike has attended:
Excel VBA Advanced course

File Open Antivirus Conflict, File Save Antivirus Conflict


I have an issue with a file open, save & close, conflict with the antivirus software on the PC, which is Kaspersky Anti-Virus 2012.
Randomly when manually performing a file open, save or close a Microsoft dialogue box will appear saying “The file is in use by another user” cancel the message & try again and it opens / saves / closes ok.
But with an Excel macro running, using the standard file open, save or close command, it puts up the message box and then prompts the user to “End” or go to “Debug” which results in the macro not completing.

What I need is a method to detect the message code, then to pause and retry the operation. If I use On Error, this is a catch all, I only want to pause & Try again if it is the specific error message.

As this is a random occurrence, albeit quite frequent, it is very difficult to test any code changes.

Environment:
I get this with Office 2007 & 2010 on both Vista Business & Windows 7 Pro the common factor is the Kaspersky both the latest version & previous version, I have in the previous version of Kaspersky excluded checking of Office files which cured the problem, but for obvious reasons am not keen to leave the antivirus disabled for Office files.

RE: File Open Antivirus Conflict, File Save Antivirus Conflict

Hi Mike

Thanks for your post.

I will run this by one of my colleagues but quite tricky to analyse the issues without first hand access to your files running in your IT environment.

This forum is more for assisting with questions related to attended training and where possible code related questions.

However this forum has a significant user community and there is a possibility that someone else may have experienced similar issues to you and have found a way round the problem.

Kind regards

Jacob

RE: File Open Antivirus Conflict, File Save Antivirus Conflict

Hi Mike, thanks for your query. It's very difficult to walk you through how to sort this problem out on this forum, so I want to give you a few key points to explore.

If you can't code your way round a dialog box/error message which is being fired by a software conflict, consider doing the coding equivalent of spotting the error message, capturing it and sending a key press to that box. You will need to use the Windows API to do this. You will also need to investigate how to the find the "handle" of a particular form that appears, the unique ID of the button on that form and then sending the equivalent of a mouse click to it. Note this is not the same as using the Sendkeys function. You may also need to involve the timer to, say, check every five seconds if that form has appeared, or alternatively the Do Events command to hand the focus back to the user while all this is occuring.

This is achievable and usually employed in complicated (and rather "patchwork") tools to release the user from having to sit through a macro for 15 mins waiting for one box to appear for them to click. This link should give you some pointers:

http://scriptorium.serve-it.nl/view.php?sid=44

Hope this helps,

Anthony

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Use the SUBTOTAL function in Excel

You can create subtotals in your spreadsheet using the SUBTOTAL function, which looks like this:

=SUBTOTAL(9,cell:cell)

9 represents the function being used (SUM), followed by the range of cells the function is operating on.

The neat thing about using the Subtotal function is that if you have used it several times in the same column or row, clicking on the AutoSum button at the end of the column or row will make Excel add only the results of cells containing the Subtotal function in that column or row.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.