Тема: Код выдает ошибку. Что неправильно?
Sub test()
Dim rng As Range
Dim aName() As String
Set rng = ActiveDocument.Range(Start:=0, End:=0)
aName = FindBookmarkNameByStart(rng) [b]<-- Error: Can't assign to array[/b]
End Sub
Private Function FindBookmarkNameByStart(rng As Range) As String
Dim i As Long
Dim j As Long
Dim aName() As String
For i = 1 To rng.Bookmarks.Count
If rng.Bookmarks(i).Range.Start = rng.Start Then
j = j + 1
ReDim Preserve aName(1 To j)
aName(j) = rng.Bookmarks(i).Name
Debug.Print "Text Find: " & rng.Bookmarks(i).Range.Text
End If
Next i
FindBookmarkNameByStart = aName
End Function
Отредактировано rizalut (10.01.2010 23:42:55)