Сталкивался с этим
А если так?
X++:
static void MVB_Excel_DocProperty(Args _args)
{
COMExcelDocument_RU excel;
FileName fileName = "C:\\Пример.xls";
COM doc;
COM app;
COM Workbook;
COM prj;
COM comp;
COM module;
COM code;
str s;
#define.vbext_ct_StdModule(1)
;
excel = new ComExcelDocument_RU();
excel.newFile(fileName,true);
doc = excel.getComDocument();
app = doc.Application();
Workbook = app.ActiveWorkbook();
prj = Workbook.VBProject();
comp = prj.VBComponents();
comp.add(#vbext_ct_StdModule);
module = comp.item(comp.count());
code = module.CodeModule();
s = strfmt(
"Sub SetDocumentProperties()\n" +
"\n" +
"ActiveWorkbook.BuiltinDocumentProperties(\"Author\").Value = \"%1\"\n" +
"ActiveWorkbook.BuiltinDocumentProperties(\"Creation Date\").Value = CDate(\"%2\")\n" +
"With ActiveWorkbook.CustomDocumentProperties\n" +
" .Add Name:=\"Автор\", _\n" +
" LinkToContent:=False, _\n" +
" Type:=msoPropertyTypeString, _\n" +
" Value:=\"%1\"\n" +
" .Add Name:=\"Дата создания\", _\n" +
" LinkToContent:=False, _\n" +
" Type:=msoPropertyTypeDate, _\n" +
" Value:=CDate(\"%2\")\n" +
"End With\n" +
"\n" +
"End Sub",
(select UserInfo where UserInfo.id == curuserId()).Name,
date2str(today(), 123, 2, 2, 2, 2, 4)
);
code.addFromString(s);
app.Run(strfmt("%1.SetDocumentProperties", module.name()));
}