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 / October 2005

Tip: Looking for answers? Try searching our database.

tabstop at right margin

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ykchanaed - 17 Oct 2005 05:11 GMT
I wantt to write a macro to insert a right align tabstop just at the right
margin of the the document.
the .rightmargin in VBA only give the point from the right edge of the
document.
Hence,

Selection.ParagraphFormat.TabStops.Add Position:= .rightmargin,
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces

only add the tabstop at the, say, 90 points from the LEFT edge of the
document.

Thanks
Jezebel - 17 Oct 2005 05:49 GMT
Position:= (Activedocument.PageSetup.PageWidth -
Activedocument.PageSetup.RightMargin -  Activedocument.PageSetup.LeftMargin)

>I wantt to write a macro to insert a right align tabstop just at the right
> margin of the the document.
[quoted text clipped - 9 lines]
>
> Thanks
ykchanaed - 17 Oct 2005 17:58 GMT
Selection.ParagraphFormat.TabStops.Add
Position:=ActiveDocument.PageSetup.rightmargin

when I tried the above, the tabstop was set at the point from the left margin,
that is, the same distance of the margin from the paper edge, but now it is
from the left margin.

> Position:= (Activedocument.PageSetup.PageWidth -
> Activedocument.PageSetup.RightMargin -  Activedocument.PageSetup.LeftMargin)
[quoted text clipped - 12 lines]
> >
> > Thanks
Doug Robbins - 17 Oct 2005 18:19 GMT
Use

Dim pos As Double
With ActiveDocument.PageSetup
   pos = .PageWidth - .LeftMargin - .RightMargin
End With
Selection.ParagraphFormat.TabStops.Add Position:=pos,
Alignment:=wdAlignTabRight

Signature

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

> Selection.ParagraphFormat.TabStops.Add
> Position:=ActiveDocument.PageSetup.rightmargin
[quoted text clipped - 23 lines]
>> >
>> > Thanks
ykchanaed - 21 Oct 2005 16:42 GMT
Hi,
thanks a lot.
I learn another way of writing macro.

> Use
>
[quoted text clipped - 32 lines]
> >> >
> >> > Thanks
ykchanaed - 17 Oct 2005 18:15 GMT
Oh  I know what you mean !
it is :
page.width minus the 2 margin lenths
thanks!

> Position:= (Activedocument.PageSetup.PageWidth -
> Activedocument.PageSetup.RightMargin -  Activedocument.PageSetup.LeftMargin)
[quoted text clipped - 12 lines]
> >
> > Thanks
Anne Troy - 17 Oct 2005 06:46 GMT
It would seem you need the "inches to points" thing. When I recorded
creating a right-aligned tab, I get this:
   Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(6.5), _
       Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces

I'm sorry I don't know how to say "right margin", but you can specify the
location in inches.
************
Anne Troy
www.OfficeArticles.com

>I wantt to write a macro to insert a right align tabstop just at the right
> margin of the the document.
[quoted text clipped - 9 lines]
>
> Thanks
ykchanaed - 17 Oct 2005 19:41 GMT
Jezebel answered my question!
Thanks anyway!

> It would seem you need the "inches to points" thing. When I recorded
> creating a right-aligned tab, I get this:
[quoted text clipped - 20 lines]
> >
> > Thanks
 
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.