For late-binding, all excel variables must be declared
as Objects and the Reference to the Excel library must be
removed. And you must add a module that contains
all Constants used (eg, xlCenter) . This module can
be download from microsoft ( support.microsoft.com)
Insert the module: XL97CONS.bas
Below is the code for late-binding: