代码:Public Sub ControlsFont(ByVal frmMain As Form)
On Error GoTo MeErr
Dim ctl As Control
Dim ctlName As String
Dim strFontName As String
Dim intFontSize As Double
'--------------------------------------------------------------------------------------------------
strFontName = "宋体"
intFontSize = 10
frmMain.Font.Name = strFontName----这句报错
frmMain.Font.Size = intFontSize----这句报错
frmMain.Font.Bold = False
求各位大侠帮忙 谢谢
On Error GoTo MeErr
Dim ctl As Control
Dim ctlName As String
Dim strFontName As String
Dim intFontSize As Double
'--------------------------------------------------------------------------------------------------
strFontName = "宋体"
intFontSize = 10
frmMain.Font.Name = strFontName----这句报错
frmMain.Font.Size = intFontSize----这句报错
frmMain.Font.Bold = False
求各位大侠帮忙 谢谢
frmMain.FontSize = intFontSize
frmMain.FontBold = False
Option Explicit
Private Sub ControlsFont(ByRef objP As Control)
Dim ctl As Control
Dim ctlName As String
Dim strFontName As String
Dim intFontSize As Double
On Error Resume Next '忽略一些不支持字体的控件设置字体属性所产生的错误
strFontName = "宋体"
intFontSize = 14
objP.Font.Size = intFontSize
objP.Font.Name = strFontName
objP.Font.Bold = True
End SubPrivate Sub Form_Load()
ControlsFont Text1
Text1.Text = "中华人民共和国"End Sub
debug.print strFontName
debug.print intFontSize 调试下这2变量的值是否正常?
估计是变量赋值不合法。
frmMain.Font.Size = intFontSize----这句报错这两句写法没有问题,注掉出错处理,然后检查其它错误。
http://topic.csdn.net/u/20110221/19/f1b4b0c0-eeaa-4581-ba03-02b9685adc2b.html