I have a Textbox1, Label1 and a AcroPDF1. M开发者_Go百科y goal is to use a barcode scanner and scan a material number. I don't have keybord or mouse available at that location. The barcode scanner gives a Enter asci at the end. That is fine but it makes it go to the next index. I tried everything not to jump to the AcroPDF but the Tabstop is already on false but it still jumps into the PDF. So I want to be able to scan at any time and a special pdf beeing displayed.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
If InStr(TextBox1.Value, "_") <> 0 Then
TextBox1.Value = Left(TextBox1.Value, InStrRev(TextBox1.Value, "_", , vbTextCompare) - 1)
End If
Label1.Caption = TextBox1.Value
TextBox1.Value = ""
AcroPDF1.LoadFile "F:\APPS\Packaging\84260388.pdf"
End If
End Sub
Thanks
not sure if I'm reading this correctly, but once the PDF is loaded you want to set focus back to the textbox? If thats the case, use the TextBox1.SetFocus()
Method after your PDF Load. That will set the cursor back to the textbox.
it is indeed not very clear how to set focus back to the form after activating axAcroPDF control. this problem is discussed in threads like this. there are 3 solutions offered, but they seem to me more like hacks, because axAcroPDF ActiveX control has in itself a rather unusual behavior. i am afraid that (finally) using this control with a complex and/or serious application is not a good idea.
精彩评论