Can't open file with macro

GASTON DIEGO FONSECA 0 Reputation points
2023-07-28T03:29:41.2066667+00:00
When I enter code in the Workbook_open method of an excel file and save it when I want to open it, I can't because it says that the file contains viruses or potentially unwanted software. How can I solve that?
Microsoft 365 and Office Excel For business Windows
Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tanay Prasad 2,250 Reputation points
    2023-07-28T06:14:33.7133333+00:00

    Hi,

    Don't worry. It's just a security warning message by Excel because macros can be used to execute potentially dangerous code.

    To resolve this issue, you will need to add the file's location to the list of trusted locations in Excel.

    Here's how you can do that-

    1. Open Excel and go to the "File" Menu.
    2. Click on "Options".
    3. In the Excel Options dialog box, select "Trust Center" on the left.
    4. Click on the "Trust Center Settings" button on the right.
    5. In the Trust Center dialog box, select "Trusted Locations".
    6. Click on the "Add new location".
    7. Browse to the folder where your Excel file with the VBA code is, and click on "OK."
    8. Ensure that the checkbox "Subfolders of this location are also trusted" is checked.
    9. Click "OK".

    Best Regards.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.