Board index » cppbuilder » Word 2k automation problem

Word 2k automation problem

Hi
I'am trying to insert text from a clipboard into a word document. But
everytime I get an exception when runs over the pasteSpecial command

***********************************************************************
int __fastcall TWord::PasteAtBookmark (AnsiString Bookmark)
{
Range *BkMk;
OleVariant Format = wdPasteRTF;
    if (this->WordDocument->Bookmarks->Exists( StringToOleStr (Bookmark)
) == true)
    {
         BkMk = this->WordDocument->Bookmarks->Item(StringToOleStr
(Bookmark))->Range;
         BkMk->PasteSpecial ( EmptyParam,
EmptyParam,EmptyParam,EmptyParam,Format,EmptyParam,EmptyParam); ***
Crash **
    }

Quote
}

Is there any other possibility to paste text at a predefined bookmark

Thanks for your help

Andreas Wehner

 

Re:Word 2k automation problem


Most likely, BkMk is null, hence the crash. Also, I'd use WideString()
instead of calls to StringToOleStr.

.a

Quote
Andreas Wehner wrote:

[snip]

Other Threads