There are a few reasons this may occur. If your machine is new, DNS may not have set up your Excel appropriately. Try this: 

  1. Start Microsoft Excel.

  2. Open a workbook.

  3. Click File and then Options.

  4. In the navigation pane, select Trust Center.

  5. Click Trust Center Settings....

  6. In the navigation pane, select Macro Settings.

  7. Ensure that Trust access to the VBA project object model is checked.

  8. Click OK.