|
ㅂ 님이 쓰신 글 :
: 안성훈 님이 쓰신 글 :
: : 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.
:
: wordBookmarks = wordDocument.OlePropertyGet("Bookmarks");
: wordBookmarks.OleFunction("Add","r1",wordRange);
: wordBookmarks.OlePropertySet("DefaultSorting",wdSortByName);
: wordBookmarks.OlePropertySet("ShowHidden",FALSE);
답변해 주신데로 하니까. 잘 됩니다. ^^
그런데,, 아래 것이 또 안되는데,, 쩝~
/************************************************************************************************/
/* Selection.PasteSpecial Link:=False, DataType:=20, Placement:=wdInLine, _ */
/* DisplayAsIcon:=False */
/***********************************************************************************************/
VTD_MONITOR->wordSelection.OleFunction("PasteSpecial",FALSE,20,wdInLine,FALSE); // 여기서 에러가 납니다.
뭐가 잘못 됐나요??
변환의 법칙이 대략 감이 오는데,, 이건 왜 안되는지.. 쩝
에러 메세지는
Project VTD_MONITOR.exe raised exception class EOleSysError with message '예외가 발생 했습니다'.
Process stopped. Use Step or Run to continue.
입니다.
추가로 부탁드립니다.
Selection.EndKey Unit:=wdLine
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Selection.PasteAndFormat (wdPasteDefault) <- 여기 괄호 부분은 어떻게 변환하는 지요??
부탁드립니다.
|