Excel UserForm Menu bar

rvc81

New Member
Joined
Dec 2, 2009
Messages
29
hello everybody,

I am using Ivan F Moala's 'API Menu maker - for Userforms' in one of my user forms. Its just amazing;however as per the author the userform MUST BE 'non modal'. does anybody know a fix to make the userform 'vbModeless'?? please see link below

Download example: http://www.xcelfiles.com/API_Userform_MenuMaker.html

Tnx
R
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try this clumsy trick : Change the code in the basAPIMNU_Loader Module to this :


Code:
Option Explicit

Private Declare Function SetTimer Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
 
Private Declare Function KillTimer Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long

Private Declare Function ShowWindow Lib "user32.dll" ( _
ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Private Declare Function FindWindow Lib "user32.dll" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Declare Function GetProp Lib "user32" _
Alias "GetPropA" _
(ByVal hwnd As Long, _
ByVal lpString As String) As Long
 
Private Declare Function SetProp Lib "user32" _
Alias "SetPropA" _
(ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal hData As Long) As Long


Sub Loader()

    Dim oVBE As Object
    Dim MSG1 As String
    Dim MSG2 As String
    
    MSG1 = "You need to allow access to the VBAProject to load the userform."
    MSG2 = "Sorry... you need to allow access to the VBAProject to load the userform."
    
    If GetProp(Application.hwnd, "SubClassingIsSafe") = 0 Then
        On Error Resume Next
            Set oVBE = Application.VBE
            If oVBE Is Nothing Then
                MsgBox MSG1
                Application.CommandBars.FindControl(ID:=3627).Execute
                Set oVBE = Application.VBE
                If oVBE Is Nothing Then
                    MsgBox MSG2: Exit Sub
                End If
            End If
        On Error GoTo 0
        With Application.VBE.CommandBars
            .FindControl(ID:=189).Execute
            .FindControl(ID:=228).Execute
        End With
    End If
    
    SetTimer Application.hwnd, 0, 1, AddressOf LoadFormNow

End Sub

Public Sub LoadFormNow()

    Dim lVBEhwnd As Long
    
    KillTimer Application.hwnd, 0
    Call SetProp(Application.hwnd, "SubClassingIsSafe", 1)
    lVBEhwnd = FindWindow("wndclass_desked_gsk", vbNullString)
    ShowWindow lVBEhwnd, 0
    #If VBA6 Then
        frmTask.Show vbModeless ' Show the form modeless.
    #Else
        Sorry
    #End If

End Sub


Sub Sorry()

    Dim MSG As String
    
    MSG = "Sorry .... dosen't run on Versions < 2000!"
    MsgBox MSG, vbExclamation
    'Application.UserControl = False
    'Application.IgnoreRemoteRequests = True
    
End Sub
 
Upvote 0
I know it is an old topic, but is there any solution to use the menu maker with the form in vbModeless?
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top