Word Automation (control by another program -- simple example):   Return to List

' Remember to set a Reference under Tools | References (within the Visual Basic Editor to the current version of Microsoft Word

Private Sub cmdModifyDocument_Click()
    Dim wrdApp As New Word.Application
    Dim wrdDoc As Word.Document

    wrdApp.Visible = True

    Set wrdDoc = wrdApp.Documents.Add

    With wrdDoc"
        .Range.InsertBefore "Hello there everyone!"
        .SaveAs "C:\Greetings.doc"
    End With

    Set wrdApp = Nothing
End Sub



Note to Webmaster