Excel Integration

Excel VBA Module

Pull firearms data directly into Excel with VBA macros. List, search, compare, and build spec sheets from live API data.

GunSpecAPI.bas

Requirements

The module uses MSXML2 for HTTP and ScriptControl for JSON parsing. Enable one reference:

1

In the VBA Editor, go to Tools > References

2

Check Microsoft XML, v6.0

3

Click OK

Setup

1

Download the file using the button above

2

Open Excel and press Alt+F11 to open the VBA Editor

3

Go to File > Import File and select the downloaded .bas file

4

Find the API_KEY constant and replace it with your key:

Private Const API_KEY As String = "test_key"
5

Save the workbook as .xlsm (macro-enabled)

Available Macros

Run from Developer > Macros or assign to buttons:

MacroWhat it does
GunSpec_ListFirearmsFetches up to 100 firearms into a new sheet with 13 columns
GunSpec_GetFirearmPrompts for a slug, creates a detail sheet with 25 fields
GunSpec_SearchFirearmsPrompts for a search query, lists matching firearms
GunSpec_CompareFirearmsPrompts for two slugs, creates a side-by-side comparison

Example: Building an Inventory Report

1

Run GunSpec_ListFirearms to pull all firearms

2

Add a "Quantity" column and fill in your inventory counts

3

Use Excel formulas to calculate totals by caliber or manufacturer

4

Run GunSpec_GetFirearm for any item needing a full spec sheet

Back to Assets