PatriciaShannon
Wed Jul 12 08:45:02 CDT 2006
Thank you very much Jay. When I was looking at the documentation for things
like MoveEnd, I didn't realize that the wdcharacter would work on a graphic.
"Jay Freedman" wrote:
> Try using this code in your macro:
>
> Dim oRgStart As Range
> Dim oRgNext As Range
>
> Set oRgStart = Selection.Range
> Set oRgNext = Selection.GoTo(what:=wdGoToGraphic, _
> which:=wdGoToNext)
> If Not oRgNext.IsEqual(oRgStart) Then
> Selection.MoveEnd unit:=wdCharacter, Count:=1
> End If
>
> The reason for using the ranges is that if there is no "next" graphic,
> the selection doesn't move, and you don't want to extend the selection
> by another character.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ:
http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the
> newsgroup so all may benefit.
>
> On Tue, 11 Jul 2006 15:51:01 -0700, Patricia Shannon
> <PatriciaShannon@discussions.microsoft.com> wrote:
>
> >Thank you. That is what I'm doing now to get to the graphic. But it doesn't
> >select the graphic. I have to click on the graphic before I run my macro.
> >If I could do the goto and select in VBA, I could incorporate it into my
> >macro and do everything in one click, instead of 3. I have a lot of these
> >screen prints to process.
> >
> >"Jezebel" wrote:
> >
> >> You don't need a macro for this. Click the 'Select browse object' button
> >> (the little circle between the double arrows at the bottom of the vertical
> >> scroll bar), and select graphic as the browse object. Then use the double
> >> arrows.
> >>
> >>
> >>
> >> "Patricia Shannon" <PatriciaShannon@discussions.microsoft.com> wrote in
> >> message news:84BC2727-C3A0-4783-9D5F-731A914FC294@microsoft.com...
> >> >I hate to bother you with such a simple question, but I haven't been able
> >> >to
> >> > get it to work.
> >> > I am trying to write a macro (so I can assign it to a key or button) that
> >> > will go to the next graphic and select it. Then I can execute another
> >> > macro
> >> > I have written that copies it to Paint, reverses colors, and copies it
> >> > back.
> >> > (If I can get the graphic selection working, I'll incorporate it into my
> >> > main
> >> > macro.)
> >> >
> >> > I can go to the next graphic, but I haven't been able to select it.
> >> > I used
> >> > Selection.GoToNext(wdGoToGraphic)
> >> > and when that didn't select the graphic, I tried
> >> > Selection.GoToNext(wdGoToGraphic).Select
> >> > but that didn't do anything different.
> >> > I've looked at help, and in this forum, but haven't been able to figure
> >> > out
> >> > how to select the graphic.
> >> >
> >> > Thank you
> >>
> >>
> >>
>