Hi, all. I have problem with virus in a form of excel VBA module spreading in our office. Particularly the virus name is "results", if anyone has ever know.
This virus module creates an excel file in deep C drive folder and keep creating new virus modules in all excel file that we open and save them as macro-enabled files.
I know how to remove the virus, by removing the virus module from the infected excel file, and delete the virus source in deep C drive folder manually.
But the problem is, whenever another infected file opened and macro is enabled, it will spread the virus again.
I know the macro for opening an excel file, and for removing a module (looks like below, not tested), but the virus will spread again if the infected file is opened and macro is enabled.
So, I want to make a macro to check all xlsm files in our computer whether it contains a certain module and remove the module if found, without opening the excel file or without enabling the macro on that file.
Is that possible?
I want to make this macro because other employees just don't know anything about macro. So I cannot tell them how to remove the virus module & source manually and prevent future infection.
Thank you for reading and thank you in advance.
This virus module creates an excel file in deep C drive folder and keep creating new virus modules in all excel file that we open and save them as macro-enabled files.
I know how to remove the virus, by removing the virus module from the infected excel file, and delete the virus source in deep C drive folder manually.
But the problem is, whenever another infected file opened and macro is enabled, it will spread the virus again.
I know the macro for opening an excel file, and for removing a module (looks like below, not tested), but the virus will spread again if the infected file is opened and macro is enabled.
VBA Code:
Sub RemoveMacroIfExists()
Dim MyFileName
Dim MyPathName
Dim MyModuleName As String
Dim MyModule As Object
'Below will be updated to be iterative
PathName = Range("A2").Value
Filename = Range("A1").Value
MyModuleName = "results"
Workbooks.Open Filename:=MyPathName & MyFileName
Workbooks(MyFileName).Activate
On Error Resume Next
Set MyModule = ActiveWorkbook.VBProject.VBComponents(MyModuleName).CodeModule
If Err.Number = 0 Then
ActiveWorkbook.VBProject.VBComponents.Remove ActiveWorkbook.VBProject.VBComponents(MyModuleName)
End If
On Error GoTo 0
End Sub
Is that possible?
I want to make this macro because other employees just don't know anything about macro. So I cannot tell them how to remove the virus module & source manually and prevent future infection.
Thank you for reading and thank you in advance.