统计VBA学习小组正式组的积分帖之作业上交贴(第20周)
本帖最后由 冠军欧洲2010 于 2012-6-6 08:39 编辑说明:
统计帖每个学员只能跟帖回复一次,也就是在原来回复楼层的基础上点编缉,不要一个链接一层楼,否则不计算积分。
各小组学员上交作业时,一定要点击“我要参加”,并注明自己的新组编号和论坛ID,如果点击过“我要参加”但没有跟帖提交作业的,扣该学员5积分;如果跟帖提交了作业,但没有点“我要参加”的,不给予评分。
请各学员看清上面的说明,免得被扣了分分!
本帖为仅楼主可见帖,直接回复即可!
作业链接:
http://www.excelpx.com/thread-245811-1-1.html 作业在哪里啊?
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then Unload Me
If KeyCode = 90 And Shift = 2 Then Me.Height = Me.Height + 10
If KeyCode = 88 And Shift = 2 Then Me.Height = Me.Height - 10
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 And Shift = 3 Then Unload Me
End Sub
来交下窗体与控件2作业!H组-h15-hactnet
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then
Unload Me
ElseIf KeyCode = 90 And Shift = 2 Then 'z=90,x=88
Me.Height = Me.Height + 10
ElseIf KeyCode = 88 And Shift = 2 Then
Me.Height = Me.Height - 10
End If
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub
呵呵,我终于做好了,请老师审批。谢谢!
代码如下:
一、分项回答:
Option Explicit
'1、按ESC键可以关闭窗体
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 27 Then
Unload Me
End If
End Sub
'2、按CTRL+Z 窗体的高度在原来的高度上+10(窗体的高度越来越高)
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 90 And Shift = 2 Then
UserForm1.Height = UserForm1.Height + 10
End If
End Sub
'3、按CTRL+X 窗体的高度在原来的基础上-10
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 88 And Shift = 2 Then
UserForm1.Height = UserForm1.Height - 10
End If
End Sub
'4、按ctrl+shift键的同时左键单击窗体,可以把窗体关闭
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) '鼠标左键按下
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub
'二、1-4问题总回答实际运行
'1-3问题答案
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 27 Then
Unload Me
End If
If KeyCode = 88 And Shift = 2 Then
UserForm1.Height = UserForm1.Height - 10
End If
If KeyCode = 90 And Shift = 2 Then
UserForm1.Height = UserForm1.Height + 10
End If
End Sub
'4问题答案
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) '鼠标左键按下
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub
C12:hrpotterPrivate Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then
Unload Me
ElseIf KeyCode = 88 And Shift = 2 Then
Me.Height = Me.Height - 10
ElseIf KeyCode = 90 And Shift = 2 Then
Me.Height = Me.Height + 10
End If
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case 27
Unload Me
End Select
If KeyCode = 90 And Shift = 2 Then
Me.Height = Me.Height + 10
ElseIf KeyCode = 88 And Shift = 2 Then
Me.Height = Me.Height - 10
End If
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then
Unload Me
End If
If KeyCode = 90 And Shift = 2 Then
Me.Height = Me.Height + 10
End If
If KeyCode = 88 And Shift = 2 Then
Me.Height = Me.Height - 10
End If
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Shift = 3 Then
Unload Me
End If
End Sub
a组学委:qushuiPrivate Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then Unload Me
If KeyCode = 90 And Shift = 2 Then Me.Height = Me.Height + 10
If KeyCode = 88 And Shift = 2 Then Me.Height = Me.Height - 10
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 And Shift = 3 Then Unload Me
End Sub
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then
Unload Me
End If
If KeyCode = 90 And Shift = 2 Then
Me.Height = Me.Height + 10
End If
If KeyCode = 88 And Shift = 2 Then
Me.Height = Me.Height - 10
End If
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub