The sample code that @duffymo code doesn't work. After making the edits that @kdsdata suggested,
I get the following error after pressing F5:
Compile error: Expected user-defined type, not project
and the following line of code gets highlighted in yellow:
Public Sub CreateWordList(TableName As String, FieldName As String, ForeignKey As String)