With

Assign multiple properties of an object.

Syntax 
      With object 
         [Statements]
      End with

Key
   object      A previously defined object variable

   Statements  Program code to be executed against object

Example

Msg =  "First line" & vbCrLf & "Second line"
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
With objWord
.Documents.Add
.Selection.TypeText Msg
.Selection.WholeStory
End With

“We could have made beautiful music together” ~ Clifford Odets (movie: The General Died at Dawn)

Related:

CreateObject - Create a WSH automation object


© Copyright SS64.com 1999-2014
Some rights reserved