Using DDEClientConv

I use a DDEClientConv to transfer data to a bookmarked Word document by using

DdeClientConv1.PokeData('Name', PChar(Edit1.Text));

It works OK, when I run the program from the Delphi platform, but running the program from outside the Delphi platform it doesn't work.

The MS-Word opens with the correct doc-file but, no data are transferred, using the PokeData procedure.
Can anybody tell me why?

Joern
rainbowsoftwareAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
might be better to post some more code ..

i can give example of using ole to insert text at a bookmark in word if that helps ..
0
rainbowsoftwareAuthor Commented:
I create and open the link by:

if DdeClientConv1.SetLink( 'WINWORD', 'Letter.doc' ) then DdeClientConv1.OpenLink;

And I transfer the data to the bookkmark by:

DdeClientConv1.PokeData( 'Name', PChar(Edit1.Text));

I have tried to write the whole path to Winword.exe:
 C:\Program Files\Microsoft office\Office\Winword

and the whole path to the doc:

C:\Documents\Letter.doc

but still it doesn't work, outside the Delphi platform.

Have you got another way to do it?

Joern

0
intheCommented:
only using ole ,dde always fails..
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

mhervaisCommented:
he is right rainbow. DDE is not worth trying.
0
intheCommented:
hi,
dde is dead ;-)

add oleauto to your uses section ,(can do similar with comobj) then

procedure TForm1.Button1Click(Sender: TObject);
var
WordApp : variant;
begin
  try
    WordApp := GetActiveOleObject('Word.Application');
  except on exception do
    WordApp := CreateOleObject('Word.Application');
  end;
 WordApp.wordbasic.fileopen('c:\test.doc');
 WordApp.Visible := True;
 WordApp.Wordbasic.EditBookmark('aBookmark', , , , -1);
 WordApp.Wordbasic.insert(edit1.text);
 WordApp.Wordbasic.insert(#13);
end;

that will got to your bookmark (named abookmark) and add some text from a tedit..

see these links to learn all about ole automation etc type of stuff:

there are tutorial (with code) about automating excel here:

http://hometown.aol.com/charliecal/TechPapers/DelphiWord.htm 

also a tutorial from borland:(see examples.zip for code)
http://www.inprise.nl/delphi/papers/microexcel/me3.html 

and another demo project here for putting data into excel:
http://inthe.future.easyspace.com/delphi/files/exceldde.zip 

also see some components here:

http://dsp.href.com/iis/iis.dll?DSP:RESULTS:723403184 

Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
intheCommented:
note,
to learn all the commands you can use you really need the vba help file ,this comes with most versions of office or it can be downloaded from various web sites just search for vba.hlp or something ..
0
rainbowsoftwareAuthor Commented:
Thanks very much to Barry for the code, and the links.
I can't use AutoOle, but ComObj is OK. Is it because I use Delphi 3?

Joern
0
intheCommented:
in delphi3 you should have some ole files in your delphi lib directory under the directory called delphi2..

it dont matter comobj be better anyway ..happy learning ;-)
0
rainbowsoftwareAuthor Commented:
Thanks again, it works perfect.
Joern
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.