|
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="r1"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
위에 매크로 소스를 bcb 에서 ole 개체로 해서 워드에 적용하려고 합니다.
매크로 내용은 워드의 표 안에 있는 문자열을 선택해서
책갈피 이름 r1 으로 추가하는 매크로 입니다.
Q&A 를 써치해 보니 매크로 변환하는 비스한 것이 있던데 아래 소스처럼해보니
에러가 나오는데 뭐가 잘못 됐는지 잘 모르겠네요..
좀 도와 주십시요..
VTD_MONITOR->wordApp = Variant::CreateObject("Word.Application");
VTD_MONITOR->wordDocuments = VTD_MONITOR->wordApp.OlePropertyGet("Documents");
VTD_MONITOR->wordApp.Exec(VisTrue);
VTD_MONITOR->wordDocument = VTD_MONITOR->wordDocuments.OleFunction("Open","D:\\VTD_MONITOR\\Test Report for PK3+ Function(Simple).doc");
// VTD_MONITOR->wordDocument = VTD_MONITOR->wordDocuments.OleFunction("Add",Variant::NoParam(),Variant::NoParam(),wdNewBlankDocument,Variant::NoParam());
// VTD_MONITOR->wordDocument = VTD_MONITOR->wordDocuments.OleFunction("Add"); // new doc open
VTD_MONITOR->wordSelection = VTD_MONITOR->wordApp.OlePropertyGet("Selection");
VTD_MONITOR->wordRange = VTD_MONITOR->wordSelection.OlePropertyGet("Range");
VTD_MONITOR->wordSelection.OleFunction("MoveDown", wdLine, 202);
VTD_MONITOR->wordSelection.OleFunction("MoveRight", wdCharacter, 2);
VTD_MONITOR->wordDocuments.OlePropertyGet("Bookmarks").OleFunction("Add",VTD_MONITOR->wordRange,"r1",wdSortByName); // 여기서 에러가 납니다.
메세지는
Project VTD_MONITOR.exe raised exception class EOleSysError with message '알 수 없는 이름입니다'.
Process stopped. Use Step or Run to continue.
|