Set Object = {[New] objectexpression | Nothing}
Assigns an object to an object variable.
Related Topics: Dim, Global, Static
Example:
Sub Main
Dim visio As Object
Set visio = CreateObject( "visio.application" )
Dim draw As Object
Set draw = visio.Documents
draw.Open "c:\visio\drawings\Sample1.vsd"
MsgBox "Open docs: " & draw.Count
Dim page As Object
Set page = visio.ActivePage
Dim red As Object
Set red = page.DrawRectangle (1, 9, 7.5, 4.5)
red.FillStyle = "Red fill"
Dim cyan As Object
Set cyan = page.DrawOval (2.5, 8.5, 5.75, 5.25)
cyan.FillStyle = "Cyan fill"
Dim green As Object
Set green = page.DrawOval (1.5, 6.25, 2.5, 5.25)
green.FillStyle = "Green fill"
Dim DarkBlue As Object
set DarkBlue = page.DrawOval (6, 8.75, 7, 7.75)
DarkBlue.FillStyle = "Blue dark fill"
visio.Quit
End Sub