On 2002-03-20 11:39, yussi1870 wrote:
I entered the code:
ActiveSheet.PageSetup.CenterHeader = "&""Times New Roman,Bold""&12" & sHeader
sHeader contains the header of another worksheet and is in Arial, Bold, 10. This is concatenated with a cell in the current worksheet. .CenterHeader code above doesn't even effect the formatting! The header from the other worksheet is still in Arial, Bold, 10 and the Cell value is still in its original formatting of Arial, Bold, 12.
Any ideas?
Thanks.
Sorry man it took so long, but here is something you can try:
*********************************************
Function sHeader(FullHeader As String)
Dim FontStripped As String
Dim StyleStripped As String
On Error Resume Next
StripIndex1 = InStr(1, FullHeader, ",")
If StripIndex1 = 0 Then
StyleStripped = FullHeader
GoTo Size
End If
FontStripped = Mid(FullHeader, StripIndex1)
StripIndex2 = InStr(1, FontStripped, Chr(34))
StyleStripped = Mid(FontStripped, StripIndex2 + 1)
Size:
sHeader = StyleStripped
If IsNumeric(Mid(StyleStripped, 2, 1)) Then
sHeader = Mid(StyleStripped, 3)
End If
If IsNumeric(Mid(StyleStripped, 2, 2)) Then
sHeader = Mid(StyleStripped, 4)
End If
If IsNumeric(Mid(StyleStripped, 2, 3)) Then
sHeader = Mid(StyleStripped, 5)
End If
End Function
*********************************************
It has worked for me in a similar situation, It's not good programming, I know, but try it and change it better if you wish. Just call the function and it should return one stripped up header value.