A
Alex St-Pierre
Hi!
I use VBA automation to apply table excel formatting into word. In this
program, all work except the Font.Underline.
bMixed = Cells(5,1).Characters(Start:=i, Length:=1).Font.Underline return
always true for any i if there's one underlined character in the cell.. Is
there a way to know which characters are underlined?
All other properties (bold, alignment, italic, superscript, etc. is correct)
Any idea?
Thank you!
Alex
With Range(Cells(iLine, jBegin), Cells(iLine, jBegin)) 'Word table range
.HorizontalAlignment =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).HorizontalAlignment
.VerticalAlignment =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).VerticalAlignment
For i = 1 To Len(.Value)
With .Characters(Start:=i, Length:=1).Font
.Bold =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Bold
.Superscript =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Superscript
.Subscript =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Subscript
.Italic =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Italic
.Underline =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Underline 'THIS DOESN'T WORK
End With
Next i
I use VBA automation to apply table excel formatting into word. In this
program, all work except the Font.Underline.
bMixed = Cells(5,1).Characters(Start:=i, Length:=1).Font.Underline return
always true for any i if there's one underlined character in the cell.. Is
there a way to know which characters are underlined?
All other properties (bold, alignment, italic, superscript, etc. is correct)
Any idea?
Thank you!
Alex
With Range(Cells(iLine, jBegin), Cells(iLine, jBegin)) 'Word table range
.HorizontalAlignment =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).HorizontalAlignment
.VerticalAlignment =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).VerticalAlignment
For i = 1 To Len(.Value)
With .Characters(Start:=i, Length:=1).Font
.Bold =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Bold
.Superscript =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Superscript
.Subscript =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Subscript
.Italic =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Italic
.Underline =
ThisWorkbook.Sheets(SheetName).Range(sLoadData).Characters(Start:=i,
Length:=1).Font.Underline 'THIS DOESN'T WORK
End With
Next i