Hi Declamatory,
Great question. See the following two Macros:
a. CreateCommandButtonAtTheBottomOfSheet1(). This macro creates the CommandButton at the bottom of 'Sheet1' and can be called from anywhere in your existing code.
b. PrintSheetsAndRemoveCommandButton(). This macro is the Shell for printing when the CommandButton is 'Left Clicked'. You have to add your print code to this routine, or have your code in another Macro that is called from this routine.
See the attached file which contains the following code in an Ordinary Code Module:
It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
This option requires all variables to be declared and will give a compiler error for undeclared variables.
Lewis
Bookmarks