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 / January 2007

Tip: Looking for answers? Try searching our database.

Getting the value of hanging indent

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
christophercbrewster - 22 Jan 2007 21:20 GMT
The VBA help file shows how to set a hanging indent:

     ActiveDocument.Paragraphs(1).TabHangingIndent(2)

The "2" signifies that the hanging indent is set with the value of the second
tab stop. What I need to do is read this value for a selected paragraph--
that is, what tab stop is used as the hanging indent for this paragraph? VBA
always seems to make the "get" function obscure. I've tried lines like this:

    ' Gives message "Argument not optional"
     TabNumUsedForHang = Selection.Paragraphs(1).TabHangingIndent

     ' Gives message  "Object does not support this object or method"
     TabNumUsedForHang = Selection.ParagraphFormat(1).TabHangingIndent

Can someone show me how to get this value? I'd like to add a function like
Value( ) around this just to see what the setting is. Thanks for any help.

Signature

Christopher Brewster
Lockheed Martin, Eagan MN

Stefan Blom - 23 Jan 2007 10:38 GMT
A hanging indent would correspond to a negative value for the
FirstLineIndent property in a ParagraphFormat object.

For example: If Selection.ParagraphFormat.LeftIndent equals 20, and
Selection.ParagraphFormat.FirstLineIndent equals -20, then the first
line of text starts at the left margin, and the rest of lines starts
at 20 pt from the left margin (this is also where the tab stop is
located).

Another example: If LeftIndent = -20 and FirstLineIndent = -20, then
the first line starts at -40 pt and the rest of lines at -20 pt.

The hanging indent is always relative to the LeftIndent value.

Signature

Stefan Blom
Microsoft Word MVP

> The VBA help file shows how to set a hanging indent:
>
[quoted text clipped - 10 lines]
>       ' Gives message  "Object does not support this object or method"
>       TabNumUsedForHang =
Selection.ParagraphFormat(1).TabHangingIndent

> Can someone show me how to get this value? I'd like to add a function like
> Value( ) around this just to see what the setting is. Thanks for any help.
christophercbrewster - 23 Jan 2007 15:10 GMT
Thanks for the response. I'm still unclear on how the code can determine the
hanging indent. Would it have to use both the LeftIndent and FirstLineIndent
values? To *set* the value, using either the code or the GUI, just uses a
simple number, and I'm trying to read that number back.

>A hanging indent would correspond to a negative value for the
>FirstLineIndent property in a ParagraphFormat object.
[quoted text clipped - 19 lines]
>> Can someone show me how to get this value? I'd like to add a function like
>> Value( ) around this just to see what the setting is. Thanks for any help.

Signature

Christopher Brewster
Lockheed Martin, Eagan MN

Stefan Blom - 24 Jan 2007 09:55 GMT
As I wrote, a negative value for FirstLineIndent indicates a hanging
indent. The exact position of text (relative to the margin) can only
be determined by also looking at the LeftIndent property.

In other words, there is nothing that directly corresponds to the
setting in the Paragraph dialog box (no "HangingIndent" property).

Note that the TabHangingIndent method can only be used to *set* a
hanging indent, not return an existing one. It is the equivalence of
the Ctrl+T shortcut in the user interface.

Signature

Stefan Blom
Microsoft Word MVP

> Thanks for the response. I'm still unclear on how the code can determine the
> hanging indent. Would it have to use both the LeftIndent and FirstLineIndent
[quoted text clipped - 24 lines]
> >> Can someone show me how to get this value? I'd like to add a function like
> >> Value( ) around this just to see what the setting is. Thanks for any help.
 
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.