I had written a post many years ago describing the process to do this but it was before the existence of the ribbon user interface and a few things have changed so I thought I would create a new post.
It’s fairly easy to create a button within the ribbon that will execute an existing VBA macro. In Inventor, have the ribbon that you want to insert your button displayed, right-click on the ribbon, and choose the “Customize User Commands…”. This will display the Customize dialog shown below. Choose “Macros” from the drop-down at the top of the command list. This will display all of your macros. Pick your macro and then click the “>>” button in the middle of the dialog. This will move that macro over to the right-hand side of the dialog. You can then choose if text should be displayed and if a large or small icon should be used. A new panel called “User Commands” will be added to the ribbon and it will contain buttons for the macros you’ve selected to give you one-click easy access to your program.
When you do this a default icon is used. If you want a custom icon you need to create a 16x16 image for a small icon or a 32x32 image for a large icon. This currently must be a bmp type of image. The name of the image is important. In this example, my macro is called “TitleBlock” and the images for it are:
Module1.TitleBlock.Small.bmp
Module1.TitleBlock.Large.bmp
Where the name is “ModuleName.MacroName.IconSize.bmp” where IconSize can be “Small” or “Large”. The files need to be in the same directory as the VBA project file. You can find out that location on your system by looking at the “File” tab of the “Application Options” dialog, as shown below. On my computer this is “C:\Users\Public\Documents\Autodesk\Inventor 2016”.
The other option to making your program easily accessible is to convert it to an add-in. This makes it very easy to share your program. You can deliver a set of files, or even an installer, and the receiver either copies the files to a specified location or just runs the installer. The next time they start Inventor they’ll see the new commands. If you get serious about writing programs you’ll want to start writing add-ins.
-Brian