Solved

Databases and OLE File Linking

Posted on 1997-09-03
3
143 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

21 Experts available now in Live!

Get 1:1 Help Now