我正在尝试创建屏幕截图。我有一个带有框架的用户表单,上面有以下代码,因此在按键时,该框架会围绕用户表单移动
Private Sub Frame1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case LCase(Chr(KeyAscii))
Case "w"
Frame1.Top = Frame1.Top - 1
Case "s"
Frame1.Top = Frame1.Top + 1
Case "a"
Frame1.Left = Frame1.Left - 1
Case "d"
Frame1.Left = Frame1.Left + 1
End Select
End Sub
我想知道的是,如果我创建另一个框架,让我们称之为frame2,当我将原始框架移到frame2上时,是否可以丝网印刷?像细胞一样与这两个框架的值有什么关系吗?还是我完全偏离了界限?
预先感谢
答案 0 :(得分:1)
尝试:
Private Sub Frame1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case LCase(Chr(KeyAscii))
Case "w"
Frame1.Top = Frame1.Top - 1
Case "s"
Frame1.Top = Frame1.Top + 1
Case "a"
Frame1.Left = Frame1.Left - 1
Case "d"
Frame1.Left = Frame1.Left + 1
End Select
If Frame1.Top = Frame2.Top And Frame1.Left = Frame2.Left Then
Application.SendKeys "({1068})"
Me.Hide
ActiveSheet.Paste 'paste somewhere
End If
End Sub