Hello, everybody!
Visual Basic Editor problem:
Is there a way to make the controls on the userform moveable with the arrow keys?Greetings!
So easyCreate UserForm1 with Label1Put into Userform module next code:
Dim prevX As Single, prevY As SinglePrivate Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) prevX = X prevY = YEnd Sub
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then Label1.Left = Label1.Left + (X - prevX) Label1.Top = Label1.Top + (Y - prevY) End IfEnd SubArrow buttons can be tied similarlyRegards,Taras
Hello, TarasIt's always nice to get a response. Thanks for the reply!But my question is different. I'm sorry I didn't make it more clear.We've opened a VBE, we've opened some custom form in edit mode. There are ten buttons and other controls on the form. We click on a button with the mouse. We want to move the button using the arrow keys during editing. I know of only one way of moving controls during editing - that is by dragging with the mouse. In many cases I feel the need to be able to move the controls during editing more precisely and the arrow keys would be the easiest and most convenient.Greetings!
RE: We've opened a VBE, we've opened some custom form in edit mode...In edit mode (VBE) you have property docker and you can place objects on the form with pixel precision.Maybe I misunderstood something?
Thanks for the reply!I know this and it can work.
Only one problem remains. I find it irresistible. How to bind a button, keyboard shortcut to be associated with a macro. Pressing the key while the Visual Basic Editor is active will run the macro. That would solve a lot of problems. How do I bind a key to a macro in VBE?Greetings!