How to use macro?

How to use self-made macro? #

Loading Add-ins in Excel vs. PowerPoint #

Although not required, using the designated folder can be convenient and helps keep your add-ins organized. So, for clarity, we can summarize the difference like this:

Excel
Automatically loads add-ins from the XLSTART folder
PowerPoint
Requires manual add-in registration, regardless of file location


Using VBA and Add-ins in Excel #

Usually, the common approach is to save your current workbook as an .xlsm file and keep the VBA code inside it. But when you need to share the file with colleagues, an .xlsm file can sometimes be a bit inconvenient.

If the macro is just for your personal use, a better way is to create an add-in (.xlam or .xla) and place it in the XLSTART folder. This way, your macro will always be available for you, without getting in the way when you share your workbook with others.

XLSTART Folder #

The XLSTART folder is usually located in the path shown below. Any file placed in this folder will automatically open whenever Excel starts — whether it’s an .xlsx file, a .txt file, or anything else.  
XLSTART folder path :

C:\Users\[User_name]\AppData\Roaming\Microsoft\Excel\XLSTART

Add-in file(.xla or .xlam) #

The .xla and .xlam files are Excel add-in files. When they are loaded from the XLSTART folder, they don’t open in a separate workbook window — instead, only the add-in features become available in Excel. This means they won’t interfere with the files you’re working on, keeping your workbooks clean while still giving you access to your personal macros.

Ribbon menu #

Now, all you need to do is create a button on the Ribbon menu and start assigning your general-purpose macros to it one by one. This way, your favorite tools are always just a click away, no matter which workbook you’re working on.
VBA code(ThisWorkbook in .xla file) :

Private Sub workbook_open()
    'shorcut
    Application.OnKey "%+^q", "showMenu"

    'ribbon menu icon
    With Application.CommandBars("tools")        
            With .Controls.Add(msoControlButton)
                .Caption = "MacroToolKit"
                .OnAction = "showMenu"
                .FaceId = 6270
                .Style = msoButtonIconAndCaption
                .Visible = True
            End With
    End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.CommandBars("tools").Reset
End Sub

 
As shown in the image below, the Add-ins menu is now active, and you can see the buttons you’ve registered. If you want to change the icon, simply modify the Faceid value in the code.
 
You can check the Faceid at the following location:
Faceid link

macrotoolkit


Using VBA and Add-ins in PowerPoint #

PowerPoint supports VBA (Visual Basic for Applications) similar to Excel, but there are some differences in how file formats and add-ins are handled. This document explains the key file types and how to use VBA in PowerPoint.

Default File Format: .pptx #

When you open PowerPoint and create a new presentation, it is saved by default in the .pptx format. This is the standard presentation format, and it does not support macros.

Macro-Enabled File Format: .pptm #

If you want to insert VBA code or use macros in your presentation, you need to save the file as a .pptm file. Since .pptx files cannot store macros, PowerPoint requires macro-enabled presentations to be saved in the .pptm format.

Add-in File Format: .ppam #

Just like Excel uses .xlam files for macro-based add-ins, PowerPoint uses .ppam files. A .ppam file contains VBA code only, without standard slide content. It is used to create custom add-ins that can extend PowerPoint’s functionality across all presentations.

PowerPoint: Manual Add-in Registration #

PowerPoint handles add-ins differently. It does not automatically load add-ins from a specific folder at startup. Instead, you need to manually register each .ppam file through the PowerPoint Add-ins menu.

While Microsoft provides a default AddIns folder for convenience (which opens automatically when you browse for add-ins), you are not required to store your .ppam files there. You can register add-ins from any location.

C:\Users\[username]\AppData\Roaming\Microsoft\AddIns\