![]() |
OleContainer Copy
Please how can I copy selected text from a Word document in Edit.
The code below is not working. Thank you
Delphi-Quellcode:
olecontainer1.OleObject.ActiveWindow.Selection.Copy;
Edit1.Clear; Edit1.PasteFromClipboard; |
AW: OleContainer Copy
using COM:
Delphi-Quellcode:
uses
ComObj; procedure TForm1.Button1Click(Sender: TObject); var WordApp : OleVariant; Doc : OleVariant; Sel : OleVariant; begin WordApp := GetActiveOleObject('Word.Application'); // Connect to open Word try try Doc := WordApp.ActiveDocument; Sel := Doc.ActiveWindow.Selection; Edit1.Text := Sel.Text; // or simple Edit1.Text := WordApp.ActiveDocument.ActiveWindow.Selection.Text; except WordApp.Visible := true; end; finally WordApp := Unassigned; // Disconnect end; end; You did't need the Clipboard! |
AW: OleContainer Copy
[QUOTE=HolgerX;1348141]using COM:
Perfect, thank you :thumb: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:21 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