Solved

Databases and OLE File Linking

Posted on 1997-09-03
3
141 Views
Last Modified: 2010-04-04
I am writing a Database application using Delphi 2. The user wants (for each record) to be able to include a MS Word document (possibly more than one) and maybe a graphic file (bitmap), again, possibly more than one.

I don't want to embed them in each record, I want to save a link to each file. I first thought of the OLEContainer, but this thing can only hold one object at any one time. I could just save the path and filename of the proposed file(s) in each record, but how could I execute the application (eg. Word) when the user wants to edit the file.

I'd like to use the InsertOLEObject Dialog box, so the user can insert an object (of their choice) at any time.

How, and what would be the best way to do this?
0
Comment
Question by:rocknroll
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1343539
Hi rocknRoll,

For executing word :

First you have to include OleAuto in your unit's uses clause, and
declare a Variable for the OLE object, like:

  var
    MsWord: Variant;

And then:

  begin
    MsWord:=CreateOleObject('Word.Basic');
    MsWord.AppShow;     {if you want word to show}
    MsWord.FileOpen('your_file.doc');
    MsWord.Insert('some text');
  end;

Don't know exactly if this is what you need, hope it is

Have fun,
c.u. ZifNab;
0
 

Author Comment

by:rocknroll
ID: 1343540
Thanks ZifNab,

what you suggested seems to work, but I have another little problem. While the user is editing a document in Word (opened by my application), and the user saves this document under another name, how can I obtain this new filename so I can change the link to it. Are there any parameters returned from Word once it is closed and my application gains control again?

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1343541
Hi R&R,

Sorry, I don't know a answer for this question, but I'll look at it. I'm going on a trip for a week or 2, so if you can wait till then. But i promise that i'll look at it!

c.u. ZifNab
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now