Hallo, zu dem folgenden Code habe ich eine Frage: gibt es eine Möglichkeit, dass Winword im Modus Minimized gestartet wird?
Wie der Code so steht, erscheint Word immer im Max; wenn der Button1 gedrückt wird! Ich weiß einfach nicht mehr weiter!
Vielen Dank schon einmal
Hans-Jürgen
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
RadioGroup1: TRadioGroup;
Button1: TButton;
Button2: TButton;
Edit6: TEdit;
Edit7: TEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses comobj, Unit2;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.itemindex := 0; //hier wird Mahnung vorgegeben
end;
procedure TForm1.Button1Click(Sender: TObject);
var word : variant;
begin
try
word := CreateOleObject('Word.Application');
except
ShowMessage('WORD konnte nicht gestartet werden !');
Exit;
end;
word.Visible := True;
word.Documents.Add;
If word.ActiveWindow.View.SplitSpecial <> 0 Then
word.ActiveWindow.Panes[2].Close;
If (word.ActiveWindow.ActivePane.View.Type = 1) Or
(word.ActiveWindow.ActivePane.View.Type = 2) Or
(word.ActiveWindow.ActivePane.View.Type = 5) Then
word.ActiveWindow.ActivePane.View.Type := 3;
word.ActiveWindow.ActivePane.View.SeekView := 9;
word.Selection.Font.Name := 'Arial';
word.Selection.Font.Size := 12;
word.Selection.Font.Bold := True;
word.Selection.ParagraphFormat.Alignment := 1;
word.Selection.TypeText(Text:='Firma XYZ - Holzweg 160 - 88999 Stein');
If word.Selection.HeaderFooter.IsHeader = True Then
word.ActiveWindow.ActivePane.View.SeekView := 10
Else
word.ActiveWindow.ActivePane.View.SeekView := 9;
word.Selection.TypeText(Text:= 'Bankverbindung: Stadtsparkasse BLZ 4711 KtoNr. 0883');
word.ActiveWindow.ActivePane.View.SeekView := 0;
word.Selection.TypeText(Text:=Edit2.Text + ' ' + edit1.Text);
word.Selection.TypeParagraph;
word.Selection.TypeText(Text:=edit3.Text);
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.Font.Name := 'Times New Roman';
word.Selection.font.Size := 12;
word.Selection.font.Bold := True;
word.Selection.TypeText(Text:=edit4.Text + ' ' + edit5.Text);
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.Font.Name := 'Arial';
word.Selection.Font.Size := 14;
word.Selection.Font.Bold := True;
word.Selection.TypeText(Text:=Combobox1.Text);
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.Font.Name := 'Times New Roman';
word.Selection.Font.Size := 12;
word.Selection.Font.Bold := True;
If radiogroup1.itemindex= 0 Then
word.Selection.TypeText(Text:='Sehr geehrter Herr ' + edit1.Text)
Else
word.Selection.TypeText(Text:='Sehr geehrte Frau ' + edit1.Text);
end;
end.
Wie der Code so steht, erscheint Word immer im Max; wenn der Button1 gedrückt wird! Ich weiß einfach nicht mehr weiter!
Vielen Dank schon einmal
Hans-Jürgen
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
RadioGroup1: TRadioGroup;
Button1: TButton;
Button2: TButton;
Edit6: TEdit;
Edit7: TEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses comobj, Unit2;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.itemindex := 0; //hier wird Mahnung vorgegeben
end;
procedure TForm1.Button1Click(Sender: TObject);
var word : variant;
begin
try
word := CreateOleObject('Word.Application');
except
ShowMessage('WORD konnte nicht gestartet werden !');
Exit;
end;
word.Visible := True;
word.Documents.Add;
If word.ActiveWindow.View.SplitSpecial <> 0 Then
word.ActiveWindow.Panes[2].Close;
If (word.ActiveWindow.ActivePane.View.Type = 1) Or
(word.ActiveWindow.ActivePane.View.Type = 2) Or
(word.ActiveWindow.ActivePane.View.Type = 5) Then
word.ActiveWindow.ActivePane.View.Type := 3;
word.ActiveWindow.ActivePane.View.SeekView := 9;
word.Selection.Font.Name := 'Arial';
word.Selection.Font.Size := 12;
word.Selection.Font.Bold := True;
word.Selection.ParagraphFormat.Alignment := 1;
word.Selection.TypeText(Text:='Firma XYZ - Holzweg 160 - 88999 Stein');
If word.Selection.HeaderFooter.IsHeader = True Then
word.ActiveWindow.ActivePane.View.SeekView := 10
Else
word.ActiveWindow.ActivePane.View.SeekView := 9;
word.Selection.TypeText(Text:= 'Bankverbindung: Stadtsparkasse BLZ 4711 KtoNr. 0883');
word.ActiveWindow.ActivePane.View.SeekView := 0;
word.Selection.TypeText(Text:=Edit2.Text + ' ' + edit1.Text);
word.Selection.TypeParagraph;
word.Selection.TypeText(Text:=edit3.Text);
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.Font.Name := 'Times New Roman';
word.Selection.font.Size := 12;
word.Selection.font.Bold := True;
word.Selection.TypeText(Text:=edit4.Text + ' ' + edit5.Text);
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.Font.Name := 'Arial';
word.Selection.Font.Size := 14;
word.Selection.Font.Bold := True;
word.Selection.TypeText(Text:=Combobox1.Text);
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.TypeParagraph;
word.Selection.Font.Name := 'Times New Roman';
word.Selection.Font.Size := 12;
word.Selection.Font.Bold := True;
If radiogroup1.itemindex= 0 Then
word.Selection.TypeText(Text:='Sehr geehrter Herr ' + edit1.Text)
Else
word.Selection.TypeText(Text:='Sehr geehrte Frau ' + edit1.Text);
end;
end.
Comment