Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Word Öffnen (https://www.delphipraxis.net/160074-word-oeffnen.html)

WizoHulk 26. Apr 2011 16:12

Word Öffnen
 
Hallo Leute,

ich habe ein kleines Problem wo ich eure hilfe benötige.
Ich möchte per Button Word oder Excel öffnen.
Ich möchte keine Worddatei öffnen.
Hat da jemand schon mal mit erfahrungen gemacht?

Danke für eure hilfe.

mkinzler 26. Apr 2011 16:13

AW: Word Öffnen
 
Entwder per ShellExecute oder per COM/OLE

skh 26. Apr 2011 18:06

AW: Word Öffnen
 
Vielleicht so..


Delphi-Quellcode:
begin     //  Comobj( Uses )!!
  try
   word := GetActiveOleObject('Word.Application');
  except
   try   // ..
    word := CreateOleObject('Word.Application');
   except
   ShowMessage('Word konnte nicht gestartet werden!');
   exit;
   end;
  end;
Es gibt aber verschiedene Möglichkeiten, zum einfachen Öffnen würde ich wie zuvor schon erwähnt,
ShellExecute nehmen.

madtom 26. Apr 2011 21:12

AW: Word Öffnen
 
Hallo,

mit der WordApplication Komponente (ab Delphi 7, glaube ich) geht auch folgendes:
Delphi-Quellcode:
with WordApplication do begin
  try
    Connect;
    Visible := True;
    Documents.Add(EmptyParam, EmptyParam, EmptyParam, EmptyParam);
    with Selection do begin
      TypeText('Some Text' + #11);
      ...
    end;
  finally
    ...
  end;
Beste Grüße
Thomas :)


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:08 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz