How To Set a "Mate Reference" in code?

I can manually create a part, and assign it a mate reference in Solidworks. I can record the VB code necessary to perform this action in code.  I can manually create an assembly file and insert the part and get the mate to work correctly. But, when I try to repeat this action in code, the mate doesn't seem to be recognized. It shows up in the "Feature Tree", just does want to "click" in. Any ideas?

Here's a thought...I had a similar problem with inserting the part into the assembly. I could do it manually, but in code, something seemed to be missing. The recorded macro did not show the missing step...namely, that the part file had to be open. When I opened the file, in code, then inserted it, everything worked. I had to "guess" what was missing. My suspicion is that something is "missing" in the recorded code, but I have no idea what.

Any code writers out there run into this?

Solidworks