Re: Move cursor to the last position



This would be a lot easier:

Selection.EndKey Unit:=wdStory

But note that a "correct" answer to your question depends on what you
are trying to do. If you moving the cursor in order to insert text at
the end of the document or modify paragraph properties of existing
text, you don't have to depend on cursor position/selections. For
example, you can access the properties of the final paragraph by
setting an object reference to it:

Dim mypara As Paragraph
Set mypara = ActiveDocument.Paragraphs.Last
With mypara
'code here
End With

--
Stefan Blom
Microsoft Word MVP


"Juan M Afan de Ribera" wrote in message
news:uy3MmronGHA.1504@xxxxxxxxxxxxxxxxxxxxxxx
Hi to everyone,

I need to move the cursor to the last position of a word document.
By now, I
have found a way to do it and it seems to work

Dim r As Range

On Error Resume Next
Set r = ActiveDocument.Paragraphs(1).Range
r.Move wdParagraph, ActiveDocument.Range.Paragraphs.Count
r.Select
Set r = Nothing
On Error GoTo 0

but I am not sure that this is the correct one.

Any ideas?

TIA.

--
Access... también exiSte...!!

Saludos,
Juan M. Afán de Ribera
[MVP Access]
http://accessvbafaq.mvps.org
http://www.mvp-access.com/juanmafan










.



Relevant Pages

  • Re: Delete single newline between tables
    ... The tool requires a selection prior to performing certain operations. ... Dim myPara as Paragraph ... For Each myPara in ActiveDocument.Paragraphs ... only drawback is that it can be a bit slow evaluating every paragraph in the ...
    (microsoft.public.word.vba.general)
  • Re: Cant double click to select a word, in a Microsoft Word document
    ... the paragraph :-) Notice how the pointer continues to appear as an I-beam. ... In Page Layout view (with an insertion point selection so the I-beam ... pointer shows when hovering over text), move the cursor to the grey area ... Start with the cursor in the left grey area, ...
    (microsoft.public.mac.office.word)
  • Re: "Find" an autonumber with a macro?
    ... Dim myPara As Paragraph ... Word will always keep this paragraph on ... For more information on applying and modifying styles see ... How to apply a style in Microsoft Word ...
    (microsoft.public.word.vba.general)
  • Re: "Find" an autonumber with a macro?
    ... Dim myPara As Paragraph ... paragraph on the same page as the next paragraph. ... For more information on applying and modifying styles see ... How to apply a style in Microsoft Word ...
    (microsoft.public.word.vba.general)
  • RE: Adding Style Word 2007 problem
    ... My first paragraph in the doc is Normal + 14 pt ... it keeps the 14 pt from where my cursor is sitting.... ... Then I add another style (in vba): ... style "_Journal font". ...
    (microsoft.public.word.vba.general)