S
singeredel
I need to set two tabs to the left of the right margin based on the length of
a string variable. This is what I have, but I don't know how to specify the
right margin in a variable. Please don't laugh too hard!
Dim CTab As Variant
Dim CTab1 As Variant
Dim CTab2 As Variant
Dim sLen As Variant
Dim sLen1 As Variant
Dim sLen2 As Variant
Dim sLen3 As Variant
Dim sLen4 As Variant
sLen1 = Len(PatientName$)
sLen2 = Len(SSN$)
sLen3 = Len(AttentionLine$)
sLen4 = Len(DOE$)
rMar = ?? establish right margin here
CTab1 = rMar - Len(sLen) - (6 / 72)
CTab2 = CTab1 - 0.15
If sLen1 >= Len2 And Len1 >= Len3 And Len1 >= Len4 Then sLen = sLen1
If sLen2 >= Len1 And Len2 >= Len3 And Len2 >= Len4 Then sLen = sLen2
If sLen3 >= Len1 And Len3 >= Len2 And Len3 >= Len4 Then sLen = sLen3
If sLen4 >= Len1 And Len4 >= Len2 And Len4 >= Len3 Then sLen = sLen4
Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(rMar
- CTab1), _
Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add
Position:=InchesToPoints(CurTab2), _
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
a string variable. This is what I have, but I don't know how to specify the
right margin in a variable. Please don't laugh too hard!
Dim CTab As Variant
Dim CTab1 As Variant
Dim CTab2 As Variant
Dim sLen As Variant
Dim sLen1 As Variant
Dim sLen2 As Variant
Dim sLen3 As Variant
Dim sLen4 As Variant
sLen1 = Len(PatientName$)
sLen2 = Len(SSN$)
sLen3 = Len(AttentionLine$)
sLen4 = Len(DOE$)
rMar = ?? establish right margin here
CTab1 = rMar - Len(sLen) - (6 / 72)
CTab2 = CTab1 - 0.15
If sLen1 >= Len2 And Len1 >= Len3 And Len1 >= Len4 Then sLen = sLen1
If sLen2 >= Len1 And Len2 >= Len3 And Len2 >= Len4 Then sLen = sLen2
If sLen3 >= Len1 And Len3 >= Len2 And Len3 >= Len4 Then sLen = sLen3
If sLen4 >= Len1 And Len4 >= Len2 And Len4 >= Len3 Then sLen = sLen4
Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(rMar
- CTab1), _
Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add
Position:=InchesToPoints(CurTab2), _
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces