vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Zippen wie die Profis!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Visual-Basic Einsteiger
Re: Word 
Autor: Michael
Datum: 04.05.02 23:14

Hallo

Die Lösung des Problems: Du musst vb schon sagen, mit welchem Word du das ganze anstellen willst!!

Noch zwei Tipps: Mach das ganze mit Textmarken und nicht mit so vielen Zeilenschaltungen. Das macht den ganzen Code sehr unübersichtlich! Wenn du Fragen hast, wie das mit den Textmarken funzt, poste ins Forum.
Zweitens: Verwende with und end with.

Gruss
Michael

Private Sub Befehl1_Click()
Dim Word As Object
Set Word = CreateObject("Word.Application") 'Objekt initialisieren
If Word Is Nothing Then
MsgBox "Konnte keine Verbindung zu Word herstellen!", 16, "Problem"
Exit Sub
End If

With Word
.Application.Documents.Add
.Application.Visible = True
.Application.Activate
.WindowState = wdWindowStateMaximize

If .ActiveWindow.View.SplitSpecial <> wdPaneNone Then
.ActiveWindow.Panes(2).Close
End If
If .ActiveWindow.ActivePane.View.Type = wdNormalView Or .ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
.ActiveWindow.ActivePane.View.Type = wdPrintView
End If
.Application.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
.Application.Selection.Font.Name = "Times New Roman"
.Application.Selection.Font.Size = 18
.Selection.TypeText Text:="Marco Nickolai"
If .Selection.HeaderFooter.IsHeader = True Then
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
.Application.Selection.Font.Name = "Times New Roman"
.Selection.Font.Size = 9
.Selection.TypeText Text:= _
"Marco Nickolai xxxxxx Telefo"
.Selection.TypeText Text:="n (xxxx) xxxxxx"
.Selection.TypeParagraph
.Selection.TypeText Text:="xxxxxxx xxxxxxxx"
.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Application.Selection.Font.Name = "Times New Roman"
.Selection.Font.Size = 8
If .Selection.Font.Underline = wdUnderlineNone Then
.Selection.Font.Underline = wdUnderlineSingle
Else
.Selection.Font.Underline = wdUnderlineNone
End If
.Selection.TypeText Text:="Marco Nickolai xxxxxx, xxxx"
.Selection.TypeParagraph
.Selection.TypeParagraph
.Application.Selection.Font.Name = "Times New Roman"
.Selection.Font.Size = 12
.Selection.Font.Bold = wdToggle
If .Selection.Font.Underline = wdUnderlineNone Then
.Selection.Font.Underline = wdUnderlineSingle
Else
.Selection.Font.Underline = wdUnderlineNone
End If
On Error Resume Next
.Selection.TypeText Text:=(txtname)
.Selection.TypeParagraph
.Selection.TypeText Text:=(txtStraße)
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText Text:=(txtPostleitzahl & " " & txtOrt)
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.Font.Bold = wdToggle
.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
.Selection.TypeText Text:=("xxxxxx, " & Format(Date, "dd.mmm.yyyy"))
.Selection.TypeParagraph
.Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.Font.Bold = wdToggle
'.Selection.TypeText Text:=(Combo1.Text)
.Selection.TypeParagraph
.Selection.Font.Bold = wdToggle
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText Text:="Sehr geehrte Damen und Herren,"
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText Text:="Mit freundlichen Grüßen"
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText Text:="Marco Nickolai"
.Selection.MoveUp Unit:=wdLine, Count:=6
End With
End Sub
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Word52Marco Nickolai04.05.02 17:16
Re: Word34Michael04.05.02 23:14
Re: Word30Marco Nickolai05.05.02 23:10

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel