Cant get Run function to work

A

andreas

Im trying to use the Run function to run a Macro with two
arguments in Microsoft Project. But i can t get it to
work. I get "An unexpected error occured with the method".
Heres my code:

_MSProject pMspApp;
_variant_t vFileSystemPK, vDbPath;

vPK = 11;
vDbPath.SetString("c:\\Test.mdb");

pMspApp.CreateDispatch("MSProject.Application");

_variant_t vTest;
vTest.vt = VT_ERROR;
vTest.scode = DISP_E_PARAMNOTFOUND;

pMspApp.Run(LPCTSTR("StartNewTpl"), vPK, vDbPath, vTest,
vTest, vTest, vTest, vTest, vTest, vTest, vTest, vTest,
vTest, vTest, vTest, vTest, vTest, vTest, vTest, vTest,
vTest, vTest, vTest, vTest, vTest, vTest, vTest, vTest,
vTest, vTest, vTest);
 
Top