TWordDocument und TWordApplication



  • Hallo,
    ich habe hier so'n Objekt namens TWordDocument und TWordApplication. Nach einiger Recherche im Internet habe mal probiert in markierte Textstellen Strings einzufügen. Leider klappt das so nicht ganz. Die Strings werden nicht an den Markierten Stellen eingefügt sonder irgendwo anders. Ätzend.
    Kann mir jemand helfen?

    Hier Code

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    	OleVariant vWhat;
    	OleVariant vBookmark;
    	OleVariant FileName;        
    String t = "H. Mustermann";
    	OpenDialog1->Execute();                                 				// Auswahl der Datei
    	FileName = (OpenDialog1->FileName);
    	WordApplication1->Connect();                   							// Verbindung zu Word herstellen
    	WordApplication1->Documents->OpenOld(FileName,EmptyParam,EmptyParam,   	// Das jeweiligen Dokument öffnet
    										EmptyParam,EmptyParam,EmptyParam,
    										EmptyParam,EmptyParam,EmptyParam,
    										EmptyParam);
    	WordDocument1->ConnectTo(WordApplication1->ActiveDocument);
    	WordApplication1->Visible = true;
    	vWhat 		=	wdGoToBookmark;
    	vBookmark	=	StringToOleStr("Name");
    	WordApplication1->Selection->GoTo(vWhat,EmptyParam, EmptyParam, vBookmark);
    	WordApplication1->Selection->TypeText(StringToOleStr("PhilippSchulze"));
    }
    

Anmelden zum Antworten