Load and run VBA macro through .NET command

<?xml encoding=”UTF-8″>By Virupaksha Aithal

Below code shows the procedure to load and run a VBA macro through .NET command. Here AutoCAD ActiveX API LoadDVB & RunMacro is used. As the code uses dynamic keyword, to use this code no need to refer the AutoCAD ActiveX (interop) references.

[CommandMethod("LoadRunVBAcOMMAND")]
public static void LoadDVBFile()
{
dynamic acadApplication = Application.AcadApplication;
acadApplication.LoadDVB(@"C:casesarea.dvb");
acadApplication.RunMacro("mytest");
}

Comments

One response to “Load and run VBA macro through .NET command”

  1. Hello, Virupaksha Aithal
    i have a problem with my Auto cad 2017. my Auto cad are continuously restarting. i have purchased this software from official site but support centre are not that much responsive.i Am taking Auto Cad Training in surat after googling i got your blog and i have hope you will solve my problem.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading