Deborah-
I have looked at your web site on Automation and explains very well the
automation of Word and Delphi. I was wondering if you know how to automate
Word and Delphi, where Word is embedded in a Delphi form and you can still
use the word functionality. Any insite would be very greatfull. Thanks
Nicole
Hi deborah,
Hope someone can help me with the following:
I am tring to select a section/piece of a word document loaded in a oleobject and have this copied into on the clipboard or ole word document container...My selection start somewhere between the doc where says "Inleiding" and ends somewhere below where says "bouwperiode"
This is my code:
Var
LVolvWord: OleVariant;
LVnStart, LVnEnd: Integer;
Begin
Try
Try
Screen.Cursor := crHourGlass;
LVolvWord := CreateOleObject('Word.Application');
LVolvWord.Visible := False; // Hide MS Word
LVolvWord.Documents.Open('c:\test.docx'); //Open the word document.
LVolvWord.ActiveDocument.Range.Select;
LVnStart := LVolvWord.ActiveDocument.Selection.Find.Execute('Inleiding');
LVnEnd := LVolvWord.ActiveDocument.Selection.Find.Execute('bouwperiode');
I need something like SelectRange(LVnStart, LVnEnd);
LVolvWord.ActiveDocument.Range.Copy; //Copy to Clipboard.
LVolvWord.ActiveDocument.Close; //Close the document.
//Now you can paste the text from clipboard.
//Memo1.PasteFromClipboard;
Except
// Error creating object
End;
Finally
LVolvWord.Quit; //Quit word.
LVolvWord := UnAssigned; //Free
Screen.Cursor := crDefault;
End;