Do not know vb but the begin command event should work for you
static void beginCommand(object sender, CommandEventArgs e)
{
doc = acadApp.DocumentManager.MdiActiveDocument;
layerId = doc.Database.Clayer;
switch (e.GlobalCommandName)
{
case "ATTEDIT"