ie when there is no "next graphic". Currently it just does nothing and continues, which is not good.
Ideally I'd like the same behavior as Selection.Find.Execute, which returns false if the find fails, but the API definition for Selection.GoTo does not mention any return value.
Dim rng As range
Set rng = Selection.range
Selection.GoTo what:=wdGoToGraphic, which:=wdGoToNext
If Selection.range.Start = rng.Start Then
MsgBox "There was no graphic to go to."
Exit Sub
Else
'Do whatever it is that you want done.
End If
However, I would try and avoid using the Selection object.
Hope this helps, Doug Robbins - MVP Office Apps & Services (Word) dougrobbinsmvp@gmail.com It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.