Djblois
12-10-2007, 10:26 AM
I am using code for a user to add a page Heading. The code works perfectly, except when the user types in a number then it will change the size of the font to the number the user typed in. Here is the code that I am using:
Sub SpeedyPageSetup()
Dim LeftHeaderText As String, centerHeaderText As String, rightHeaderText As String
LeftHeaderText = frmExtraTableFormating.LeftText.Value
centerHeaderText = frmExtraTableFormating.CenterText.Value
rightHeaderText = frmExtraTableFormating.RightText.Value
If Not LeftHeaderText = "" Then
With ActiveSheet.PageSetup
.LeftHeader = "&""Arial,Bold""&10" & LeftHeaderText
End With
End If
If Not centerHeaderText = "" Then
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Bold""&12" & centerHeaderText
End With
End If
If Not rightHeaderText = "" Then
With ActiveSheet.PageSetup
.RightHeader = "&""Arial,Bold""&10" & rightHeaderText
End With
End If
End Sub
I tried using some code that I was already using and adjusting it:
With Application.WorksheetFunction
fnCalcTime = " " & .Text(.Min(shtLookup.Columns(lgColumn)), _
"mm\\dd\\yy") & " - " & .Text(.Max(shtLookup.Columns(lgColumn)), _
"mm\\dd\\yy")
End With
However that second set of code is when I know the format the numbers will go in. The code that I am working on now, I have no idea what the format will be - I want it to be in the exact format that the user types it in. It can be the same as it is there "mm\\dd\\yy" or it can be "yyyy" or it can be 00.00. I have no idea, it can be any format.
Sub SpeedyPageSetup()
Dim LeftHeaderText As String, centerHeaderText As String, rightHeaderText As String
LeftHeaderText = frmExtraTableFormating.LeftText.Value
centerHeaderText = frmExtraTableFormating.CenterText.Value
rightHeaderText = frmExtraTableFormating.RightText.Value
If Not LeftHeaderText = "" Then
With ActiveSheet.PageSetup
.LeftHeader = "&""Arial,Bold""&10" & LeftHeaderText
End With
End If
If Not centerHeaderText = "" Then
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Bold""&12" & centerHeaderText
End With
End If
If Not rightHeaderText = "" Then
With ActiveSheet.PageSetup
.RightHeader = "&""Arial,Bold""&10" & rightHeaderText
End With
End If
End Sub
I tried using some code that I was already using and adjusting it:
With Application.WorksheetFunction
fnCalcTime = " " & .Text(.Min(shtLookup.Columns(lgColumn)), _
"mm\\dd\\yy") & " - " & .Text(.Max(shtLookup.Columns(lgColumn)), _
"mm\\dd\\yy")
End With
However that second set of code is when I know the format the numbers will go in. The code that I am working on now, I have no idea what the format will be - I want it to be in the exact format that the user types it in. It can be the same as it is there "mm\\dd\\yy" or it can be "yyyy" or it can be 00.00. I have no idea, it can be any format.