-3

Want to bypass worksheet open as well as bypass userform object, and I don't want to execute userform code, I simply want to immediately go directly to the code view of a specific userform. Anyone know a way?

Explored internet and tried creating a macro but to no avail. Near I can get is ALT-F11 but it does not take you immediately to a userform code. Have to scroll a long list of forms to get to its code. This is what I'm trying to avoid. When you are developing code, the steps to get to the code multiple times could be lessened considerably if this quick path was available or existed. Tie the code and object to a single toggle button? Also open to vs or other executable that will accomplish same.

  • With MZ-Tools you can save favourite code elements ... – Ike May 17 '23 at 13:29
  • This looks like an alternate approach to code development. I've not used or heard of MZ-Tools. I played around with it but have not seen how it will take me directly to the code of a specific userform from a list of many userforms, modules and worksheets. – blackpepper May 18 '23 at 16:02
  • Look for "add to favourite code elements" in the MZ-Tools menu. And then show the favourite code elements window (Ctrl + F2) – Ike May 18 '23 at 16:35

1 Answers1

2

Office 2019

Private Sub Workbook_Open()
   Application.CommandBars.ExecuteMso "VisualBasic"
End Sub

I don't know of any way that programmatically takes you (automatically) to the code of the form after you define its name parametrically. But if there was such a possibility, then on opening it would always take you to the code of the same form. If you wanted something else the next time you opened it, you had to change the name of the form in the assumed code. In short, you should know the name of the form or are you only interested in the form you are currently working on? For both, do the following: In the code of the form, put its name as a comment, e.g. '@@@myform, and in the one you are working on, put another comment '@@@###

When the VB window opens in any module, search either @@@myform or @@@### to go directly to where you want.

  • Thank you for this reply. I tested it and found that it does open the code window; however, it does not take me to the specific userform code. I still have to scroll lots of userforms to get to the one I want to change/modify. This manual search is unproductive. – blackpepper May 18 '23 at 16:00
  • I will give you a tip in my answer – ΑΓΡΙΑ ΠΕΣΤΡΟΦΑ May 18 '23 at 17:03