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
hWnd should also be LongPtr in that code as it's a handle.
I make it like you say. The form is appear, but when I try ti choose command nothing happen. Do you know Why?
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.
The available controls can be found in: https://interoperability.blob.core.windows.net/files/MS-CUSTOMUI2/%5bMS-CUSTOMUI2%5d.pdf
I need some like this.
Ok, those macros that are called needs to be called only from the form?
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.
This should work on 64bit.
Thank you it worked but if I want to show another userform and hide menu userform it is bug and close again can I make to show another userform by clicking on menu? Can you tell me how? click on "ShellRun" like example.
Try moving the code back to the Initialize event, as in the attached version.
Thank you very much! It working how I expect. Thanks again.