我遇到了一个错误并且不知道如何修复它。
我必须在这里定义什么子函数或函数?
此代码以黄色突出显示:
Private Sub Worksheet_Activate() <<<--- Yellow marked line
Application.ScreenUpdating = False
vidWidth = GetSystemMetrics(SM_CXSCREEN)
vidHeight = GetSystemMetrics(SM_CYSCREEN)
If vidWidth > 1400 Then ActiveWindow.Zoom = 100
If vidWidth < 1400 Then ActiveWindow.Zoom = 96
If vidWidth < 1361 Then ActiveWindow.Zoom = 94
If vidWidth < 1281 Then ActiveWindow.Zoom = 88
If vidWidth < 1025 Then ActiveWindow.Zoom = 72
Application.ScreenUpdating = True
End Sub
错误图像:
答案1
我猜你没有声明该函数GetSystemMetrics
。确保在例程顶部有此行:
Public Declare Function GetSystemMetrics Lib "user32.dll" (ByVal index As Long) As Long
如果您已经声明了该函数,请在您的帖子中包含相关的完整代码。