Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9209031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:44:50+00:00 2026-06-18T00:44:50+00:00

I am buliding a delphi form to add a new word document in MS

  • 0

I am buliding a delphi form to add a new word document in MS Word and wait for the user to insert text and edit document, save the file and exit form MS Word, then get me the file name and path to the file.

 WordApp := CreateOleObject('Word.Application');
 WordApp.Visible := True;
 Doc := WordApp.Documents.add();

wait for user insert text and edit document and save file and exit form MS Word THEN

Doc.Save;
DocName := Doc.Name;
Docpath := IncludeTrailingPathDelimiter(Doc.path) + DocName;

with ZipForge1 do
begin
  FileName := Zipfilename;
  OpenArchive;
  Options.StorePath := spNoPath;
  AddFiles(Docpath);
  CloseArchive;
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:44:51+00:00Added an answer on June 18, 2026 at 12:44 am

    You could write your own event sink to listen to the Word application’s OnQuit event. However, it’s going to be easier to switch to early bound COM. The import type library, found in Word2000.pas, contains all that you need.

    • Use TWordApplication for your application object.
    • Assign your handler(s) to the events of the application object.
    • Depending on precisely what you want to do, the events that seem most applicable are OnDocumentBeforeClose and OnQuit.

    To illustrate, here’s the most trivial example that I can devise:

    uses
      Word2000;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      WordApp: TWordApplication;
    begin
      WordApp := TWordApplication.Create(Self);
      WordApp.Visible := True;
      WordApp.Documents.Add(EmptyParam, EmptyParam, EmptyParam, EmptyParam);
      WordApp.OnQuit := WordAppQuit;
      WordApp.OnDocumentBeforeClose := WordDocumentBeforeClose;
    end;
    
    procedure TForm1.WordAppQuit(Sender: TObject);
    begin
      ShowMessage('Word application quit');
    end;
    
    procedure TForm1.WordDocumentBeforeClose(ASender: TObject; 
      const Doc: WordDocument; var Cancel: WordBool);
    begin
      ShowMessage(Doc.Name + ' closed');
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If an RC file is modified, Delphi will compile it again. If an RC
I am new to Delphi and I'm building a custom control derived from TStringGrid.
I am buliding an NetBeans Platform application. When the user clicks on the X
I have started building a new component in Delphi 6 Pro. Currently it just
I've just reinstalled a new machine and a new Delphi XE on it, Delphi
I am building a form in Delphi that has a dropdown of Services and
I converted a 2.8 MB XML file into a ClientDataSet in Delphi XE. The
When building a Delphi 2009 component package, how do you specify which directory should
I'm building a delphi application which does scientific simulation. It's growing in complexity &
Building a new Mobile Web Platform for Mobile Users to purchase & download content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.