Thema: Delphi Open Dialog autoconnect

Einzelnen Beitrag anzeigen

Benutzerbild von RWarnecke
RWarnecke

Registriert seit: 31. Dez 2004
Ort: Stuttgart
4.408 Beiträge
 
Delphi XE8 Enterprise
 
#9

Re: Open Dialog autoconnect

  Alt 26. Mär 2010, 15:57
Wann tritt das Problem auf ? Wenn Du Word geschlossen hast oder offen hast ?

Edit:
Dieses Beispiel funktioniert :
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var FileName:OleVariant;
  vWhat, vBookmark:OleVariant;
begin
  if OpenDialog1.Execute then
    FileName := OpenDialog1.FileName
  else
    exit;
  if assigned(WordApplication1) then
  begin
    WordApplication1.Connect;
    WordApplication1.Documents.OpenOld(FileName, EmptyParam, EmptyParam,
      EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
      EmptyParam, EmptyParam);
    WordDocument1.ConnectTo(WordApplication1.ActiveDocument);
    WordApplication1.Visible := True;
    vWhat:=wdGoToBookmark;
    vBookmark:='Name';
    WordApplication1.Selection.GoTo_(vWhat,emptyParam,emptyParam,vBookmark);
    WordApplication1.Selection.TypeText('Max Mustermann'#13'Dorfstraße 100');
  end;
end;
Rolf Warnecke
App4Mission
  Mit Zitat antworten Zitat