Here's how you can solve this issue:-


For Excel 2003

(a) Start MS-Excel

(b) Select option "Tools >> Macros >> Security"

(c) In the Security Window choose the "Trusted Publisher Tab"

(d) Click "Trust Access to Visual basic Project" and enable it.

(e) Click OK.

(f) Close MS-Excel

For Excel 2007

(a) Start MS-Excel

(b) Click the Microsoft Office Button, and then click Excel Options.

(c) Click Trust Center.

(d) Click Trust Center Settings.

(e) Click Macro Settings.

(f) Click to select the Trust access to the VBA project object model check box.

(g) Click OK to close the Excel Options dialog box.

(h) Close MS-Excel

For Excel 2010 and higher

(a) Start MS-Excel

(b) Select option "File >> Help >> Options"

(c) Click Trust Center.

(d) Click Trust Center Settings.

(e) Click Macro Settings.

(f) Click to select the Trust access to the VBA project object model check box.

(g) Click OK to close the Excel Options dialog box.

(h) Close MS-Excel

Remarks:-

This is to be done once only. No need to open any Excel sheet. Just start MS-Excel and change the settings as mentioned above.