【发布时间】:2014-07-16 13:30:53
【问题描述】:
Access 2013可以通过vba代码增加消息框的字体大小吗?
从这里
到这里
有些用户已超过 40 岁。他们需要更大尺寸的字体才能查看。谢谢!
【问题讨论】:
标签: ms-access vba ms-access-2010 ms-access-2013
Access 2013可以通过vba代码增加消息框的字体大小吗?
从这里
到这里
有些用户已超过 40 岁。他们需要更大尺寸的字体才能查看。谢谢!
【问题讨论】:
标签: ms-access vba ms-access-2010 ms-access-2013
系统错误框的字体大小是系统控件,需要在所有单独的计算机上进行更改。
您可以改为在 VBA 中捕获错误并通过用户窗体显示您自己的消息,这将允许您控制消息和字体。
所以,而不是
If countDuplicate > 0 Then
MsgBox _
"A record of this Part ID already exist. No changes can be made.", _
vbCritical, _
"Duplicated Record"
Me.Undo
End If
您将拥有以下内容:
If countDuplicate > 0 Then
frm_AlreadyExists.Show
Me.Undo
End If
frm_AlreadyExists 是您将创建的表单,其中包含您在上面列出的消息。
这应该让你开始。作为进一步的步骤,您可以创建一个包含 Error ID、Error Message、Error Type、Error Title 列的错误表,而不是为每个错误单独创建一个 UserForm。
Error ID Error Message Error Type Error Title Button Action Button Text
1 A record ... already exist. Critical Duplicated Record SubName1 Click Here
2 ... not a valid EMPLOYEE Critical Invalid GID SubName2 Click Here
然后您将使用以下内容调用UserForm:
If countDuplicate > 0 Then
ErrorID = 1 'You'll need to declare this variable elsewhere in your code
frm_AlreadyExists.Show
End If
以及初始化UserForm的代码(在UserForm代码模块中)
Private Sub UserForm_Initialize()
Dim lErrorID As Long
Dim sErrorMessage As String
Dim sErrorType As String
Dim sErrorTitle As String
Dim sBtnText As String
lErrorID = errorID
''Look up the following from the Error Table
'sErrorMessage = Result from lookup
'sErrorType = Result from lookup
'sErrorTitle = Result from lookup
'sBtnText = Result from lookup
Me.lbl_ErrorMessage = sErrorMessage
Me.img_ErrorType.Picture = "C:/File Location/" & sErrorType & ".jpg"
Me.Caption = sErrorTitle
Me.btn_Action.Caption = sBtnText
End Sub
以及按钮点击的代码
Private Sub btn_Action_Click()
Dim sBtnAction As String
''Look up the following from the Error Table
'sBtnAction = Result from lookup
Application.Run sBtnAction
End Sub
通过这个以及一些调整和代码混乱,您现在可以拥有一个自定义错误/消息系统,允许您(甚至用户)设置消息的字体。
【讨论】: