Use of VBProject Triggering McAfee (X97M Virus/Generic)

JTWood

New Member
Joined
Mar 3, 2008
Messages
35
I'm using the following code to write to a worksheet's module after it is created:

Code:
Sub buildVBA()

Dim vbc As Object
Dim StartLine As Long
Dim cLines As Long
        
For Each vbc In ThisWorkbook.VBProject.VBComponents
       
    If vbc.Properties("Name") = "Comparison - Critical" Then
    
        With vbc.CodeModule
            cLines = .CountOfLines + 1
            .InsertLines cLines, _
                "Private Sub Worksheet_SelectionChange(ByVal Target As Range)" & Chr(13) & _
                "Call *******(Target, ""criticalRange"")" & Chr(13) & _
                "End Sub"
        End With

Next vbc

End Sub
Short Version
This is triggering a McAfee alert for my users who have it installed on their system. Those settings are controlled by their IT departments. I can see if their IT departments will grant an exception, but I anticipate it being quite difficult and would prefer to work around this issue myself.

Is there a better way to accomplish my goal that won't **** off a virus scanner?

Long Version
I need to utilize the Private Sub Worksheet_SelectionChange(ByVal Target As Range), but the worksheet where that code should reside is deleted and rebuilt with each update. My workaround was to house the main portion of the code in a Module and then utilize VBProject to write a call to that code into the worksheet after it is rebuilt. Unfortunately, it seems that use of this code is consistent with some ancient viruses from the mid-90s that McAfee still keeps an eye out for, so some of my clients have reported that the code is completely wiped clean as soon as they receive the file. I know they could change the settings for their virus program, but at least one of them said that option is reserved for an admin (read: IT dept). I'm sure it will be a pain to get authorization to change those settings, so I'd like to fix this myself.

Is there a better way to accomplish my goal that won't **** off a virus scanner? Is it possible to write to a worksheet module through another method that doesn't utilize VBProject, or is there a different way to utilize VBProject that doesn't put up a big, red flag?

Thanks, in advance.

ps - Why does this site blot out on_Click (no underscore)? :eek:
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
If you are creating a new worksheet and then adding code, why not instead instance it from a template sheet that already has the code in it?
 
Upvote 0

Forum statistics

Threads
1,214,535
Messages
6,120,093
Members
448,944
Latest member
SarahSomethingExcel100

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top