J
Julie Mascara
I have a process where I run a mail merge to create pages
of labels. The labels are contained in a table. After
the merge is complete, I would like to run a VBA to tell
me if any of the text on the label did not fit and had to
be wrapped to the next line. I thought I could use the
following code to see if the vertical position of the 1st
character is different than the last; however, I must be
doing something wrong because the values for each cell in
the row are the same. Please help!!!!!! Julie
For Each oTable In ActiveDocument.Tables
For Each oCell In oTable.Range.Cells
Set myRange = oCell.Range
begRange = myRange.Information
(wdVerticalPositionRelativeToPage)
myRange.MoveEnd unit:=wdCharacter, count:=-1
endRange = myRange.Information
(wdVerticalPositionRelativeToPage)
If (begRange <> endRange) Then
Debug.Print myRange.Text + " " + CStr
(begRange) + " " + CStr(endRange)
End If
Next oCell
Next oTable
OUTPUT - the third line is actually wrapped
2134BWHT 72 95
ADF2VHT 72 95
LONGNAME575AWTLONGNAME575AWHTTHEEND 72 95
575BWHT 72 95
562VHT 72 95
of labels. The labels are contained in a table. After
the merge is complete, I would like to run a VBA to tell
me if any of the text on the label did not fit and had to
be wrapped to the next line. I thought I could use the
following code to see if the vertical position of the 1st
character is different than the last; however, I must be
doing something wrong because the values for each cell in
the row are the same. Please help!!!!!! Julie
For Each oTable In ActiveDocument.Tables
For Each oCell In oTable.Range.Cells
Set myRange = oCell.Range
begRange = myRange.Information
(wdVerticalPositionRelativeToPage)
myRange.MoveEnd unit:=wdCharacter, count:=-1
endRange = myRange.Information
(wdVerticalPositionRelativeToPage)
If (begRange <> endRange) Then
Debug.Print myRange.Text + " " + CStr
(begRange) + " " + CStr(endRange)
End If
Next oCell
Next oTable
OUTPUT - the third line is actually wrapped
2134BWHT 72 95
ADF2VHT 72 95
LONGNAME575AWTLONGNAME575AWHTTHEEND 72 95
575BWHT 72 95
562VHT 72 95