Board index » cppbuilder » Find and replace text in Words
bernd
![]() CBuilder Developer |
Find and replace text in Words2004-08-16 04:02:45 PM cppbuilder48 I would like to find and replace textstrings in a words document using C++ Builder version 6. Connect and disconnect to the WordsApplication component as well as connect and disconnect to the WordDocument works fine. Also the following is ok: WordApplication->Selection->TypeText(StringToOleStr("newCompany")); WordApplication->Selection->Find->Forward = true; But, if I try the following, I got the error messages mentioned there WordApplication->Selection->Find->Replacement->Text=StringToOleStr("newCompanyName"); WordApplication->Selection->Find->Text = StringToOleStr("CompanyName"); [C++ Error] Unit1.cpp(115): E2247 'Find::Text' is not accessible OleVariant replace = 1; WordDocument->Range(EmptyParam, EmptyParam)->Find->Execute(StringToOleStr("CompanyName"),\ EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,\ EmptyParam, StringToOleStr("newCompany"), replace); [C++ Error] Unit1.cpp(112): E2285 Could not find a match for 'Find::Execute(wchar_t *,OleVariant,OleVariant,OleVariant,OleVariant,OleVariant,OleVariant,OleVariant,OleVariant,wchar_t *,OleVariant)' What is wrong here or is there a better method to replace text strings? Thanks in advance Bernd |