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

I

info

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
 
B

Brian

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.
 

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