关于vb实时错误 70 拒绝的权限
调试下面这段程序出现实时错误 70 拒绝的权限错误代码指向SendKeys "{Home}+{End}"这应该是光标选中密码框中文本请问这个问题应该如何解决Private Sub cmdOK_Click()'检查正确的密码If txtpassword = "1986" Thenloginsucceeded = TrueMsgBox "恭喜", , "登陆成功"un = txtUserName.Textpw = txtpassword.TextDialog.ShowMe.HideElseMsgBox "无效的密码,请重试!", , "登录"txtpassword.SetFocusSendKeys "{Home}+{End}"End IfEnd Sub
参考答案:如果没有问题的话,换一种方法试一下,将以下语句
SendKeys "{Home}+{End}"
改为:
txtpassword.SelStart = 0
txtpassword.SelLength = Len(txtpassword.Text)