Dividing sections - Formatting

S

Srini

Hello,

I have a dot file with content of 2 pages. I have divided these 2
pages into 3 sections from Menubar -> Insert -> Break -> Section break
Types -> Continuous

Now what i need to do is to BOLD the content in the second section. How
can i do this???
Tried this option but not working...
ActiveDocument.sections(2).range.bold = true

If the document is having two sections only, then this is working
ActiveDocument.sections.first.range.bold = true or
ActiveDocument.sections.last.range.bold = true

Please help me.

Thanks
Srini
 
C

Charles Kenyon

It may seem intrusive to ask, but _why_ are you using section breaks to
divide your document? Continuous section breaks can be very helpful but they
are often the cause of multiple headaches as well. If it is just to do this
formatting, I would guess that Styles would be a better method.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
S

Srini

Charles,

Right now there is tons of code behind the scenes which makes the
content unbold based on x,y,z conditions...i donna touch that so
...simply the content which i want to make is kep in one sections and
bold it.

I do admit its a headache but it is a temp solution.

Thanks for your help

Regards,
Srini
 
C

Charles Kenyon

Be aware that bold and italics are both toggle formatting. That is, you can
end up switching partially bolded text so that the text which was not bold
now is, and that which was bold, is now plain.

One thought that comes to mind would be to run the following code for your
document to make sure you don't have more sections than you think you do.
That is one of the headaches you get from continuous section breaks applied
to small portions of a document. It could be that you have a section with no
text.

MsgBox "Sections in this document = " & ActiveDocument.Sections.Count
' gives number of sections - or

Sub WhichSection()
' Adapted from http://word.mvps.org/FAQs/MacrosVBA/GetIndexNoOfPara.htm
MsgBox "The cursor is in section: " & _
ActiveDocument.Range(0,
Selection.Sections(1).Range.End).Sections.Count
End Sub

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top