Webs Property Example

This example creates an array that contains all of the URLs for all the open webs on your Web site.

Note   You must open any webs for which you wish to retrieve the URLs.

Private Sub GetWebs()
Dim myWebs As Webs
Dim myWeb As Web
Dim myOpenWebs() As Variant
Dim i As Integer
Dim myWebCount As Integer

Set myWebs = Application.Webs
myWebCount = myWebs.Count

ReDim myOpenWebs(myWebCount)

Do
For Each myWeb In myWebs
    myOpenWebs(i) = myWeb.Url
    i = i + 1
Next
Loop Until i > myWebCount

End Sub