Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Fri, 4 Jul 2008 19:20:33 +1000,    group: microsoft.public.word.vba.general        back       


Re: figure out cursor location in word 03   
The following code will insert a next page section break after the paragraph 
in which the cursor is located:

Dim myrange As Range
Set myrange = Selection.Paragraphs(1).Range
myrange.Collapse wdCollapseEnd
myrange.InsertBreak wdSectionBreakNextPage


-- 
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"daniel lie"  wrote in message news:...
> Message-ID: 
> X-Mailer: http://www.umailcampaign.com, ip log:58.6.69.163
> Newsgroups: microsoft.public.word.vba.general
> NNTP-Posting-Host: 22.bb.5446.static.theplanet.com 70.84.187.34
> Path: TK2MSFTNGP01.phx.gbl!TK2MSFTNGP03.phx.gbl!newspe.com
> Lines: 1
> Xref: TK2MSFTNGP01.phx.gbl microsoft.public.word.vba.general:121581
>
> Thank you Doug and Steven for your replies.
>
> Steven, apologise for not making it a lot clearer for you to understand my
> problem.
>
> Yes, your assumption's right. It's the empty line I was talking about.
> However, not sure what you meant by "but in relation to what?".
>
> I tried the code you gave and it still doesn't work. I think this may be 
> to
> do with the fact that there is a page break involved there in the code.
>
> Here is the code i got
>    myValue = InputBox("Enter here: ")
>
>    If myValue <> "" Then
>        myText = Trim(myValue)
>
>        ' Insert a heading for the new section.
>        Selection.Style = ActiveDocument.Styles("Section Heading 1")
>
>        Selection.Bookmarks("\line").Select
>        While Len(Selection.Text) > 1
>            Selection.Move wdLine, 1
>            Selection.Bookmarks("\line").Select
>        Wend
>        Selection.Collapse wdCollapseStart  'move cursor to the start of 
> the
> new paragraph
>
>        ' Add a paragraph break to return to "Normal" text.
>        Selection.InsertBreak Type:=wdPageBreak
>        Selection.TypeText (myText)
>        Selection.TypeParagraph
>    End If
>
> In the mean time, trying to figure how to use .range
>
> Thank you in advance
>
> url:http://www.ureader.com/msg/10228359.aspx
date: Fri, 4 Jul 2008 19:20:33 +1000   author:   Doug Robbins - Word MVP

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us