Hey there Ron.
It's been way too long since I've done any coding, but I see (kinda) where you're going with this. After testing this:
(defun c:Mat2Lay (/ mat pat)
(setq mat "Anodized - Blue-Gray")
(setq pat "Container001 - Left Side")
(vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
(and (wcmatch (strcase (vla-get-name l)) (strcase pat))
(vl-catch-all-apply 'vla-put-material (list l mat))
)
)
(princ)
)
It's still not changing the material. Here's a screen shot of what I'm trying to accomplish:
Also, I tried (setq (entsel)) to grab an object on the target layer, but I'm not sure how to list it's properties, after using View->Inspect like you're showing above in the VLISP editor to see exactly what the material name is. I think not having the proper material name may be throwing it, or at least if not, I can narrow things down a bit.
I appreciate the help tho amigo.