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

Tip: Looking for answers? Try searching our database.

Retrieve value of a tabstop setting of a custom style and use it in a macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
info@academic-help.com - 04 Jul 2007 12:51 GMT
Dear Experts:

I need to retrieve the value of the left tabstop (there is only one
left tabstop) setting of a custom defined style and use this value in
a macro that sets the left tabstop for certain sections.

I got no idea how I can retrieve this information. Help is
appreciated. Thank you very much in advance.

Regards,  Andreas

Sub SetTabStops()

   Dim i As Integer
   Dim sect As Section

For i = 2 to 3
Set sect = ActiveDocument.Sections(i)

  With sect.Headers(wdHeaderFooterFirstPage)
.LinkToPrevious = False
.Range.ParagraphFormat.tabstops.ClearAll
.Range.ParagraphFormat.tabstops.Add _
  Position:=CentimetersToPoints(VALUE OF THE LEFT TAB SETTING OF A
CUSTOM DEFINED HEADER STYLE IS TO BE FILLED IN HERE),
alignment:=wdAlignTabLeft, Leader:= wdTabLeaderSpaces

  End With
next i
End Sub
Brian - 04 Jul 2007 14:14 GMT
I found this code that reads the tab settings then writes them to a message
box.

Sub ReadTabs1()
Dim sTmp As String, i As Integer, Para As Paragraph
Set Para = Selection.Paragraphs(1)
For i = 1 To Para.TabStops.Count
 sTmp = sTmp & CStr(Para.TabStops(i).Position / 72) & _
   ": " & CStr(Para.TabStops(i).Position) & vbCrLf
Next
MsgBox sTmp
End Sub

Use the sTmp to set the tab position.

Hope this helps.

Signature

Brian McCaffery

> Dear Experts:
>
[quoted text clipped - 26 lines]
> next i
> End Sub
 
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.