|
[code]#import "acax19ENU.tlb" no_implementation raw_interfaces_only
#include <comdef.h>
#include <atlbase.h>
#include <acadi_i.c>
using namespace AutoCAD;
LoadVBARunMacro()
{
// setup the VBA macro DVB details
CComBSTR bsrtVBAName = _T("d:\\temp\\Project.dvb");
// setup the macro name :pass your macro name here
CComBSTR bstrMacro = _T("test");
// get acad's iDispatch
IAcadApplicationPtr pAcad = acedGetIDispatch(FALSE);
// now load the DVB
HRESULT hr = pAcad->LoadDVB(bsrtVBAName.m_str);
// if ok
if (SUCCEEDED(hr))
{
// run the macro
hr = pAcad->RunMacro(bstrMacro.m_str);
// unload the DVB if you want
hr = pAcad->UnloadDVB(bsrtVBAName.m_str);
}
}[/code] |
|