Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

Getting to the end of range

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sukhi - 14 Feb 2006 16:38 GMT
Hello
I use Range object to insert text in paragraphs. when text is inserted, the
cursor still stays at the beginning (at the book mark).

           Set rBMRange = .Bookmarks("P1_WhatYouMightGetBack").Range
           rBMRange.Text = Trim(rsMYS!para_text)
I want to carry on typing more text from database, without having
unnecessary bookmarks.

How do I get to end of text, and how do I type carriage return
(selection.typeparagraph with selection).
Dave Lett - 14 Feb 2006 17:35 GMT
Hi,

You can use something like the following:

Set rBMRange = ActiveDocument.Bookmarks("P1_WhatYouMightGetBack").Range
''' insert your text and add a paragraph at end of range
rBMRange.Text = Trim(rsMYS!para_text) & vbCrLf

'''select the end of the range
rBMRange.Collapse Direction:=wdCollapseEnd
rBMRange.Select

HTH,
Dave

> Hello
> I use Range object to insert text in paragraphs. when text is inserted, the
[quoted text clipped - 7 lines]
> How do I get to end of text, and how do I type carriage return
> (selection.typeparagraph with selection).
Sukhi - 15 Feb 2006 09:51 GMT
Thanks Dave
That works wonders, I get the new paragraph from database and just display
it :--
  rBMRange.text="This is the new paragraph displayed after the carriage
return"

Now, what if some of the text in above paragraph is in Bold, as I understand
I can only do this
 rBMRange.bold=true, which apply to whole text.

I can store the bold text in different row in database, but that is too messy.

Is there a way to format part of the text in range

Sukhi

> Hi,
>
[quoted text clipped - 22 lines]
> > How do I get to end of text, and how do I type carriage return
> > (selection.typeparagraph with selection).
Dave Lett - 15 Feb 2006 13:10 GMT
Hi,

Yes, you can format all or part of the range.
rBMRange.Words(4).Bold = True
will make "new" bold whereas

rBMRange.Find.Execute FindText:="paragraph"
rBMRange.Bold = True
will make "paragraph" bold

HTH,
Dave

> Thanks Dave
> That works wonders, I get the new paragraph from database and just display
[quoted text clipped - 38 lines]
> > > How do I get to end of text, and how do I type carriage return
> > > (selection.typeparagraph with selection).
Sukhi - 15 Feb 2006 15:51 GMT
Thanks dave
but I need find text in range within '' marks and make it bold then move on
to next single quotes and so on.

for example
 You must read the later sections starting ‘What you might get back when
you are <Retirement_Age>' to see the important notes.

in the above example i need from 'What you......<Retirement_Age>' bold, i
cant use find, cos <Retirement_Age> is populated at run time.

Thanks in advance

> Hi,
>
[quoted text clipped - 51 lines]
> > > > How do I get to end of text, and how do I type carriage return
> > > > (selection.typeparagraph with selection).
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.