读书人

VBA Word编程解决方案

发布时间: 2013-01-07 10:02:24 作者: rapoo

VBA Word编程
用 Add 方法可在指定区域内添加备注。下列示例紧接着选定内容添加一条备注。

Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Comments.Add Range:=Selection.Range, _
Text:="review this"
如何用BCB表示呢?另外Delete方法又如何实现呢?
[解决办法]
OLE专业户来也!!!
翻译过来大概是这个样子:

vWordApp.OlePropertyGet("Selection").OleProcedure("Collapse", 0); // wdCollapseEnd
Variant vRange = vWordApp.OlePropertyGet("Selection").OlePropertyGet("Range");
AnsiString strText = "review this";
vWordApp.OlePropertyGet("ActiveDocument").OlePropertyGet("Comments")
.OleFunction("Add", vRange, strText.c_str());

读书人网 >C++ Builder

热点推荐