The way to execute this code at the AutoCAD command line is by including open & closing parenthesis:
(ahmktable numr)
I just don't know what that numr argument is for since that's not used anywhere in the entire code.
So enter anything like "1" would work:
(ahmktable "1")
Or modify the beginning of the code to eliminate the need to include the numr argument and execute the command without the parenthesis:
(defun c:ahmktable (/ colwidth lst numcolumns numrows rowheight sp vgms x)
Then entering the following at the command line will run it:
ahmktable
Now reading through the code it requires the following additional changes:
1. Though the drawing may already have an existing Table Style called: "PartSchedule", this part of the code will cause it to exit:

(vlax-for dname dictobj
(if (= (vla-get-name dname) "PartSchedule" )
(progn
(setvar 'ctablestyle "PartSchedule")
(princ "found")
)
(progn
(alert "The PartSchedule table style does not exist \nWill now exit")
(exit)
)
)
)
So I would change it to this:
(vlax-for dname dictobj
(if (= (vla-get-name dname) "PartSchedule" )
(progn
(setvar 'ctablestyle "PartSchedule")
(princ "found")
)
)
)
(if (/= (getvar 'ctablestyle) "PartSchedule")
(progn
(alert "The PartSchedule table style does not exist \nWill now exit")
(exit)
)
)
2. The Block called: PARTLIST-TXT actually has 8 Attributes but the current code does not include the Attribute Tag: NOTE?

So if you want to include this in the Table then a number of lines would need to be changed to accommodate an additional column in the Table:
;(setq numcolumns 7)
; replaced with
(setq numcolumns 8)
;
; commented out
;(vla-settext objtable 1 3 "Detail")
;(vla-settext objtable 1 4 "Mix Design")
;(vla-settext objtable 1 5 "Texture")
;(vla-settext objtable 1 6 "Mat'l")
; replaced with
(vla-settext objtable 1 3 "Note")
(vla-settext objtable 1 4 "Detail")
(vla-settext objtable 1 5 "Mix Design")
(vla-settext objtable 1 6 "Texture")
(vla-settext objtable 1 7 "Mat'l")
;
; commented out
;(vla-Setcolumnwidth Objtable 3 1.0)
;(vla-Setcolumnwidth Objtable 4 1.6)
;(vla-Setcolumnwidth Objtable 5 1.6)
;(vla-Setcolumnwidth Objtable 6 0.85)
; replaced with
(vla-Setcolumnwidth Objtable 3 2.6)
(vla-Setcolumnwidth Objtable 4 1.0)
(vla-Setcolumnwidth Objtable 5 1.6)
(vla-Setcolumnwidth Objtable 6 1.6)
(vla-Setcolumnwidth Objtable 7 0.85)
;
; commented out
; (vla-settext objtable numrows 4 (nth 5 lst))
; (vla-settext objtable numrows 5 (nth 6 lst))
; (vla-settext objtable numrows 6 (nth 7 lst))
; replaced with
(vla-settext objtable numrows 4 (nth 4 lst))
(vla-settext objtable numrows 5 (nth 5 lst))
(vla-settext objtable numrows 6 (nth 6 lst))
(vla-settext objtable numrows 7 (nth 7 lst))
;
3. The following lines crash the code so change them to:
; commented out
;(vla-SetAlignment Objtable (+ acDataRow acHeaderRow acTitleRow) acMiddleCenter)
; replaced with
(vla-SetAlignment Objtable acHeaderRow acMiddleCenter)
;
; commented out
; (vla-SetTextHeight Objtable acHeaderRow (* 1.5 txt))
; replaced with
(vla-SetTextHeight Objtable acHeaderRow (* 1.5 txtht))
;
4. You'll also need at least one inserted PARTLIST-TXT Block for selection to include in the Table like on of these:

5. Lastly after the Block selection & Attribute value collection in the code they need to be properly positioned in the Table by adding this line of code:
; added
(setq lst (reverse lst))
;
So when the code now runs the result looks like this:

I've included the revised code + sample dwg.
FYI: Reference following site for Table creation:
https://hyperpics.blogs.com/beyond_the_ui/2012/07/creating-a-table-style-with-autolisp-and-the-activ...