Excel VBA Module
Pull firearms data directly into Excel with VBA macros. List, search, compare, and build spec sheets from live API data.
Requirements
The module uses MSXML2 for HTTP and ScriptControl for JSON parsing. Enable one reference:
In the VBA Editor, go to Tools > References
Check Microsoft XML, v6.0
Click OK
Setup
Download the file using the button above
Open Excel and press Alt+F11 to open the VBA Editor
Go to File > Import File and select the downloaded .bas file
Find the API_KEY constant and replace it with your key:
Private Const API_KEY As String = "test_key"Save the workbook as .xlsm (macro-enabled)
Available Macros
Run from Developer > Macros or assign to buttons:
| Macro | What it does |
|---|---|
GunSpec_ListFirearms | Fetches up to 100 firearms into a new sheet with 13 columns |
GunSpec_GetFirearm | Prompts for a slug, creates a detail sheet with 25 fields |
GunSpec_SearchFirearms | Prompts for a search query, lists matching firearms |
GunSpec_CompareFirearms | Prompts for two slugs, creates a side-by-side comparison |
Example: Building an Inventory Report
Run GunSpec_ListFirearms to pull all firearms
Add a "Quantity" column and fill in your inventory counts
Use Excel formulas to calculate totals by caliber or manufacturer
Run GunSpec_GetFirearm for any item needing a full spec sheet


