Skip to content

Instantly share code, notes, and snippets.

@NewProggie
Created February 6, 2013 20:35
Show Gist options
  • Save NewProggie/4725563 to your computer and use it in GitHub Desktop.
Save NewProggie/4725563 to your computer and use it in GitHub Desktop.
Kleines VBS-Skript zum Wordbrief an Kunden schreiben
Sub Brief_schreiben()
Dim word_app As Word.Application
Dim word_doc As Word.Document
' Aktive Zelle ermitteln und Adresse rausfischen
Dim CustomerAddress as string
CustomerAddress = Cells(ActiveCell.Row, 4).value
If CustomerAddress = "" Then
MsgBox "Bitte Kunde auswählen", , "Fehler"
Exit Sub
End If
' Word oeffnen und neues Dokument erstellen
Set word_app = New Word.Application
Set word_doc = word_app.Documents.Add(DocumentType:=wdNewBlankDocument)
' Adresse schreiben
word_app.Selection.TypeText CustomerAddress
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment