
Active Member

February 25, 2022



November 8, 2013

Hi Ivaylo,
The form does not load on my side, this line errors out:
g_lpMyWndProc = SetWindowLong(g_hForm, GWL_WNDPROC, AddressOf HookWinProc) (a data type mismatch error)
That mismatch should be fixed by changing the data type of the arguments for the failing procedure, the form loads now.
I changed this function, the part in red:
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As LongPtr) _
As Long


Trusted Members
Moderators

November 1, 2018



November 8, 2013

Is there a reason for using this menu in a userform?
You have much better options, you can build a custom menu in ribbon, even in runtime if a dynamic menu is needed.
Will work in a Mac as well, not limited to windows as the current code is.
See: https://docs.microsoft.com/en-.....19a3cc94b5
The available controls can be found in: https://interoperability.blob......UI2%5d.pdf


November 8, 2013

They can be called from ribbon, not seeing any reason to use them only in form.
The custom ribbon can be created only for a specific file, but if you want it to show up on every excel file, you have to create the menu on an addin.
See image attached for a custom ribbon.


Trusted Members
Moderators

November 1, 2018

1 Guest(s)
