You might try setting a Range and doing everything in that.
Dim rngWork As Range
Set rngWork = ActiveDocument.Range(Selection.Range.Start,
ActiveDocument.Content.End)
With rngWork.ParagraphFormat.TabStops
.ClearAll
.Add Position:=InchesToPoints(1.25), _
Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
.Add Position:=InchesToPoints(3), _
Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
End With
With a range, the actual selection (insertion point) never moves. You can
click in the doc, run this macro, and then pick up where you clicked.
HTH
Ed
> > You would have to reveal how your macro is "pumping out the rest of the
> > document."
[quoted text clipped - 10 lines]
> But I'm not sure how to turn off the selection and return to my original
> position. Any thoughts? Thanks much.
Rick Charnes - 25 Oct 2005 22:09 GMT
Right, I had a feeling that using a range was the answer. But when I
paste this in to my VBA editor, it doesn't like the below line which
gets split over two lines with "Start," ending line 1 -- both lines
appear in red. Am I typing something wrong? Thanks.
> Set rngWork = ActiveDocument.Range(Selection.Range.Start,
> ActiveDocument.Content.End)
Ed - 25 Oct 2005 22:40 GMT
Sorry - should have warned you about the line stuff. Lines of code can
often get pretty long - too long for the NG reader to handle without
breaking. And of course they will always break in bad spots! That all
should be on one line.
Alternatively, you can use a "line break" (I don't know what the proper VBA
name is), which is a space and an underscore before you hit Enter. So your
lines could be
Set rngWork = ActiveDocument.Range(Selection.Range.Start, _
ActiveDocument.Content.End)
or
Set rngWork = ActiveDocument.Range _
(Selection.Range.Start, ActiveDocument.Content.End)
whichever suits your purposes.
HTH
Ed
> Right, I had a feeling that using a range was the answer. But when I
> paste this in to my VBA editor, it doesn't like the below line which
[quoted text clipped - 3 lines]
> > Set rngWork = ActiveDocument.Range(Selection.Range.Start,
> > ActiveDocument.Content.End)