Friday, November 30, 2018

Maintain aspect ratio of window Excel VBA with auto resize (zoom)

Have you ever created a cool application or spreadsheet in Excel?  Some of you may have even taken steps to remove the ribbon and status bar so that the user must use the program as you intended it.

The problem with this, is you might end up with the user resizing the window and seeing cells outside of the bounds that you want them to view.

Another problem you might run into, is you have users who wish the window to be larger or smaller on their screen.  To fix this issue, add this VBA code to your Excel program. Don't forget to also add a reference to this code in the Workbook_WindowResize function.

Note: This code works best in office 2016. Earlier versions of office don't trigger the Workbook_WindowResize event when the application window changes size. To fix this, you can run this subroutine recursively with an application.ontime, or you can add it to another event such as Workbook_SheetSelectionChange.

VBA Add an animated Notification Box to your Excel Program

For those of us who create programs and add-ins in Excel, we are very, very familiar with the message box.  The message box gives us the opp...