0
votes

I am using excel and learning how to code in vba for macro buttons.

I was trying to create button and put a code so that when I double click on the button vba window gets open instead of using shortcut alt+f11.

Can anyone please provide any details if there is any code ? Thanks

1
could try giving Application.SendKeys agoSlappedProgrammer
Can you please provide complete code for as I am beginner and can’t understand ? Thanksuser3102147
Why would you want to do that? Can you explain the use case?Geert Bellekens
Insert a button and in the onclick event put Application.SendKeys("%f11") I think that would work, give it a try. docs.microsoft.com/en-us/office/vba/api/…SlappedProgrammer
universal answer: if you're a total beginner, try using the recorder. Then examine the code.Patrick Honorez

1 Answers

2
votes

This will do it:

Private Sub CommandButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Application.VBE.MainWindow.Visible = True
End Sub

Put this in the sheet object your button is on.