+ Reply to Thread
Results 1 to 5 of 5

VBA best practices to avoid virus false positives?

  1. #1
    Forum Contributor
    Join Date
    08-12-2019
    Location
    NYC
    MS-Off Ver
    MS 365
    Posts
    167

    VBA best practices to avoid virus false positives?

    Hi everyone,

    I have an excel spreadsheet that I share online with a variety of users. The excel spreadsheet is pretty complex and also includes some VBA. It seems like my VBA frequently triggers false positives from antiviruses as well as windows itself (which blocks all macros by default and send warning messages), creating issues to share the spreadsheet. Typical AV culprits are VirusTotal (a website that tests files through dozens of antivirus apps) and, more annoyingly, Gmail (which won't let me send the spreadsheet by email sometimes).

    So I was wondering if there were any best practices I should follow when working on files with VBA? I can't remove the VBA itself because it's absolutely necessary to the spreadsheet, but maybe I can find and rework certain things that have a higher chance of triggering antiviruses.

    On a related note, do you think paying for a digital certificate from a third party would help with building trust for the file and reducing issues when sharing it?

    Thanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,618

    Re: VBA best practices to avoid virus false positives?

    To be honest, I doubt that the content or complexity of the code is a factor. I suspect that it is simply the fact that it is there is the issue.

    Windows now adds a level of security to files that are downloaded or emailed for the protection of the recipient. Any file with suspect content will be marked as blocked. This is so that the recipient can, and should, check the content before unblocking it.

    Files that I download from the forum that do not have code are not blocked. Those that do, are blocked.

    You could try zipping the file(s) up. I don't know how many layers the anti-virus software will peel away in order to check the content.

    Or, a more tedious option: you could export all the code to .bas files and send them as text, alongside the "bare" spreadsheet, with instructions on how to re-import the code modules.

    I've never used a digital certificate so I can't comment on that. You would hope that the AV software (and windows) would be capable of reading and accepting the certificate. But I wouldn't spend a lot of money without checking it out.

    Google: free digital certificate
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-12-2019
    Location
    NYC
    MS-Off Ver
    MS 365
    Posts
    167

    Re: VBA best practices to avoid virus false positives?

    Thanks, appreciate the suggestions.

    The .bas file approach is unpractical because a lot of my users are not "tech savvy" (i.e. they barely know the difference between Excel and Google Sheets), so I can't imagine putting them through that.

    The zip approach could be interesting, I need to do some tests to see if it helps!

    Yes, definitely need to to some additional research about certificates, hopefully, that can help with this whole issue!

    Thanks again

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,618

    Re: VBA best practices to avoid virus false positives?

    You're welcome.

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,543

    Re: VBA best practices to avoid virus false positives?

    In addition to the standard macro blocking that depends on settings in Excel itself, antivirus programs can report a threat if Win API functions are used in the code. It doesn't matter then that you're using the code for a good purpose, because the antivirus doesn't analyze all the code to consider it safe (or not). Win API function declarations alone are enough to raise an alarm. The antivirus can only report an alarm for certain declarations of these functions, those that are used by pests to attack your computer.
    Macro blocking can be changed in the Options settings. Antivirus alarms can be blocked (hopefully in all AV programs) by adding the name of a file and/or folder to a "whitelist."

    Zipping files is not an obstacle for AV programs these days. Certainly at the first level of packing AV is able to analyze the code. As Trevor mentioned perhaps there is a certain limit of packing depth above which AV no longer analyzes code. But deeper than that, beyond the first level, I have never checked.

    I also have no experience with digital signatures, but it certainly reduces the difficulty of running the file on the target user's computer.

    Artik

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formulas Throwing False Virus Positives?
    By NewYears1978 in forum Excel General
    Replies: 0
    Last Post: 02-13-2023, 01:33 PM
  2. How to avoid the FALSE result in a formula
    By toony in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2021, 06:21 AM
  3. [SOLVED] Formula to convert negative numbers into positives but leave positives as positive
    By T.Turner in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-27-2019, 05:46 PM
  4. Removing False Positives
    By spunner87 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-16-2018, 11:34 AM
  5. in IF two positives coming up false.
    By barrowinfurnace in forum Excel General
    Replies: 5
    Last Post: 09-09-2016, 09:08 AM
  6. [SOLVED] Array LOOKUP False Positives
    By chrisboughter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-05-2014, 11:47 AM
  7. Excel reporting false positives.
    By nezza in forum Excel General
    Replies: 4
    Last Post: 11-10-2009, 12:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1