![]() |
Word mit OLE-Automation steuern
Kleine hoffentlich einfache Frage. Ich habe Word über OLE gestartet und
möchte nun gern den varianlen(###Pat&) durch text aus meine Programme ersetzen mit deise Funktion:
Delphi-Quellcode:
function FindenUndInsert(FindText, ReplacementText : string ) : boolean;
const wdReplaceAll = 2; begin WordApp.Selection.Find.Text := FindText; WordApp.Selection.Replacement.Text := ReplacementText; FindenUndInsert := WordApp.Selection.Find.Execute(Replace := wdReplaceAll); end; procedure TfrmDocument.BitBtn12Click(Sender: TObject); Function CreateWord:boolean; begin CreateWord:=true; try W:=CreateOleObject('Word.Application'); except CreateWord:=false; end; End; Function AddDoc:boolean; Var Doc_:variant; begin AddDoc:=true; try Doc_:=W.Documents.Add(ApplicationDir + BriefeDir + 'Standardtumorbrief.dot'); //Doc_.Add; except AddDoc:=false; end; End; begin if CreateWord then begin If AddDoc then begin try FindenUndInsert('###Pat&', 'TEXT'); except On E:Exception do begin MyDialog.Msg('Fehler', E.Message + 'Fehler!', mb_ICONExclamation); end; end; end; end; end; dann kommt FEHLER!!!! "Metod 'Replacement' not supported by automation object".............. :-((((((( Viele Dank im Voraus! [edit=sakura] [delphi]/Tags Mfg, sakura[/edit] |
Re: Word mit OLE-Automation steuern
Zitat:
Delphi-Quellcode:
[edit]Innerhalb von 5 Minuten in VBAWD10.CHM gefunden :wink: [/edit]
WordApp.Selection.Find.Replacement.Text := ReplacementText
|
Re: Word mit OLE-Automation steuern
Ich danke DIR!!!!!!!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:43 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz