T
Thomas Lindberg
The AtEndOfDocument VBA code, as published by Microsoft, does not always
work.
Function AtEndOfDocument()
If Selection.Type = wdSelectionIP And Selection.End =
ActiveDocument.Content.End - 1
AtEndOfDocument = True
Else
AtEndOfDocument = False
End If
End Function
The code above does not work if the last End of Paragraph sign (is that the
correct expression??) is selected.
The code below works also if the last End of Paragraph sign is selected.
Function AtEndOfDocument()
If Selection.Type = wdSelectionIP And Selection.End =
ActiveDocument.Content.End - 1 Or _
Selection.Type = wdSelectionNormal And Selection.End =
ActiveDocument.Content.End Then
AtEndOfDocument = True
Else
AtEndOfDocument = False
End If
End Function
Now to the questions:
- Are there any hooks with the improved code?
- How come that this trivial issue never (???) has been discussed before?
- Why is not AtEndOfDocument a VBA built in function as in Visual Basic??
(OK, silly qustion but ..)
Thomas
work.
Function AtEndOfDocument()
If Selection.Type = wdSelectionIP And Selection.End =
ActiveDocument.Content.End - 1
AtEndOfDocument = True
Else
AtEndOfDocument = False
End If
End Function
The code above does not work if the last End of Paragraph sign (is that the
correct expression??) is selected.
The code below works also if the last End of Paragraph sign is selected.
Function AtEndOfDocument()
If Selection.Type = wdSelectionIP And Selection.End =
ActiveDocument.Content.End - 1 Or _
Selection.Type = wdSelectionNormal And Selection.End =
ActiveDocument.Content.End Then
AtEndOfDocument = True
Else
AtEndOfDocument = False
End If
End Function
Now to the questions:
- Are there any hooks with the improved code?
- How come that this trivial issue never (???) has been discussed before?
- Why is not AtEndOfDocument a VBA built in function as in Visual Basic??
(OK, silly qustion but ..)
Thomas