是否有可能通过VBA code,以提高访问2013的消息框中的字体大小?
Is it possible to increase the font size of message box in Access 2013 via vba code?
在此
本
有些用户是40岁以上。它们需要字体的更大尺寸以供查看。谢谢!
Some users are over 40 years old. They require a bigger size of font for viewing. Thanks!
推荐答案
系统错误框的字体大小是一个系统的控制,将需要所有的个人计算机上进行更改。
The font size of system error boxes is a system control and would need to be changed on all individual computers.
您可以改为陷阱VBA中的误差,并通过用户窗体,这将允许您控制消息和字体来显示自己的消息。
You could instead trap the error in VBA and display your own messages via a UserForm, which would allow you to control the message and the font.
所以,而不是
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
是,您将创建并会让你上面列出的消息的形式。
Where frm_AlreadyExists
is a form that you would create and would have the message you listed above.
这应该让你开始。为进一步,而不是有一个单独的用户窗体
的每个错误,您可以创建将包含一个错误的表错误ID
,错误信息
,错误类型
,错误标题
列。
That should get you started. As a further step, instead of having a separate UserForm
for each error, you could create an error table that would contain Error ID
, Error Message
, Error Type
, Error Title
columns.
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
然后你会调用用户窗体
为以下内容:
If countDuplicate > 0 Then
ErrorID = 1 'You'll need to declare this variable elsewhere in your code
frm_AlreadyExists.Show
End If
而code初始化用户窗体
(在用户窗体code模块)
And the code to initialize the UserForm
(in the UserForm code module)
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
而$ C $下按钮,点击
And the code for the button click
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
通过这一点,一些调整和code搞乱,你现在可以有一个自定义的错误/信息系统,该系统将允许你(甚至用户)来设置字体为消息。
With this and some tweaking and messing with code, you can now have a custom error/message system that would allow you (or even the user) to set the font for the messages.
相关推荐
最新文章