We help IT Professionals succeed at work.

COM Applications in Delphi5

Raymod
Raymod asked
on
Medium Priority
248 Views
Last Modified: 2010-04-06
Currently creating a project to interface with an access2000 database.  One field in a table contains an OLE link to a  word document.  How do I activate this document for editing if there is one there, or create a new one if needed?
Comment
Watch Question

Commented:
When you say"OLE link" do you mean theres just a word doc name there or is there a CLSID ?

Opening a Word document with ole is quite easy.
var
  Word: Variant;
begin
  try
    Word := GetActiveOleObject('Word.Application');    
  except
    Word := CreateOleObject('Word.Application');    
  end;
  Word.Visible := True;
 
  then to create a new document,
   Word.Documents.Add(EmptyParam, EmptyParam);
   
   or to open an existing one,
   var
  FileName: OleVariant;
  begin
  FileName := 'C:\My Documents\The file I want to open.doc';
  Word.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam,
                  EmptyParam, EmptyParam, EmptyParam, EmptyParam,
                EmptyParam, EmptyParam);
               
               
 A really good site for this is
 http://www.djpate.freeserve.co.uk/AutoWord.htm


regards
Smurff
Raymod:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
CERTIFIED EXPERT

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

accept smurff's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer