Results 1 to 7 of 7

Thread: VBA USERFORM NOT LOADING dISPLAYING ERROR MESSAGE

  1. #1
    Junior Member
    Join Date
    Nov 2023
    Posts
    4
    Rep Power
    0

    Post VBA USERFORM NOT LOADING dISPLAYING ERROR MESSAGE

    I am new in learning Userform VBA code, I designed the Userform with ClsTabMenu,Module1 and Usefrom Code but on clicking to load is diplaying

    Run-time error "91"
    Object Variable or With block variable not set

    find attached excel and codes below

    ClsTamenu coding
    Code:
    Private Declare PtrSafe Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Any) As Long
    Private Declare PtrSafe Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
    
    'ColorDestaq
    
    Const ColorDestaq = 16730978
    
    Public WithEvents mForm             As MSForms.UserForm
    Public WithEvents mPage             As MSForms.MultiPage
    
    Public WithEvents TabLabel          As MSForms.Label
    Public WithEvents TabIcon           As MSForms.Label
    Public WithEvents ActiveTab         As MSForms.Label
    Public WithEvents TabLine           As MSForms.Label
    
    Public LabelTop                    As Integer
    Public LabelLeft                   As Long
    Public LineLeft                     As Integer
    
    Const IDC_HAND As Long = 32649
    
    Sub MouseMoveIcon()
        Dim hCursor As Long
        hCursor = LoadCursor(0, ByVal IDC_HAND)
        SetCursor hCursor
    End Sub
    Sub CreateTabMenu(form As MSForms.UserForm, muPage As MSForms.MultiPage)
        Dim Ctrl                As Control
        Dim mPageName           As String
        Dim tempCol             As New Collection
        Dim IconCode            As String
        
        Set mForm = form
        Set mPage = muPage
        
        i = 1
        '//Önce labellar kontrol edilir ve sýrasýna gore collactiona eklenir
        '//First, the labels are checked and added to the collection in order.
        
    head:
        For Each Ctrl In mForm.Controls
            TagValue = GetValue(Ctrl, 0)
            mPageName = GetValue(Ctrl, 1)
            If TagValue = "TabMenu" And mPageName = mPage.Name Then
                
                If CInt(GetValue(Ctrl, 2)) = i Then
                    tempCol.Add Ctrl
                    i = i + 1
                    
                    GoTo head:
                End If
            End If
        Next
        
        '//Form yüksekliðinden tabmenu eleman sayýsý ve aralarýndaki
        '//boþluk kadar çýkarýp ikiye bölerek yukarýdan ve aþaðýdan eþit boþluk býrakýyoruz
        
        '//Number of tabmenu elements from form height and between them
        '//We remove as much as the space and divide it into two, leaving equal space from above and below.
        LabelTop = (mForm.InsideHeight - ((tempCol.Count + tempCol.Count) * 20)) / 2
        
        Index = 1
        
        '//Yukarýda tempcol isimli Koleksiyona eklemiþ olduðumuz elemanlarýn dizaynýný yapýyoruz
        '//We are designing the elements we have added to the Collection named tempcol above.
        For i = 1 To tempCol.Count
            
            Set Ctrl = tempCol(i)
            LabelDesign Ctrl
            LineLeft = Ctrl.Left + Ctrl.Width + 15
            
            If GetValue(Ctrl, 2) = 1 Then
                '//Eðer ctrl ilk Tablabel ise activeTab oluþturulur
                '//If ctrl is the first Tablabel, activeTab is created
                
                Set ActiveTab = mForm.Controls.Add("Forms.Label.1", "ActiveTab")
                With ActiveTab
                    .Height = 40
                    .Width = 4
                    .BackColor = ColorDestaq
                    .BackStyle = fmBackStyleOpaque
                    .Top = LabelTop - 10
                    .Left = LineLeft - 1
                End With
                
                '//Ayný þekilde birinci elemana göre yan taraftaki çizgi ayarlanýr
                '//In the same way, the line on the side is adjusted according to the first element.
                Set TabLine = mForm.Controls.Add("Forms.Label.1", "TabLine")
                With TabLine
                    .BackColor = RGB(212, 212, 212)
                    .Width = 1.4
                    .Left = LineLeft
                    .BackStyle = fmBackStyleOpaque
                    .ZOrder 1
                End With
                Ctrl.ForeColor = ColorDestaq
                Ctrl.Font.Name = "Poppins"
                Ctrl.Font.Bold = True
                
                LabelLeft = Ctrl.Left
            Else
                
            End If
            Ctrl.Left = LabelLeft
            
            IconCode = tempCol(i).ControlTipText
            '//Kontrolün ControlTiptex'i dolu ise icon oluþturulur
            '//if the ControlTiptex of the control is full, the icon is created
            If IconCode <> "" Then
                Set TabIcon = mForm.Controls.Add("Forms.Label.1", "TabIcon" & tempCol(i))
                With TabIcon
                    .Font.Name = "Segoe MDL2 Assets"
                    .Font.Size = 14
                    .ForeColor = RGB(51, 51, 51)
                    .BackStyle = fmBackStyleTransparent
                    .Caption = ChrW("&H" & tempCol(i).ControlTipText)
                    .Left = Ctrl.Left - 35
                    .Top = LabelTop
                    .ZOrder 1
                End With
            End If
            
            LabelTop = LabelTop + Ctrl.Height + 20
            
            Set tb = New ClsTabMenu
            Set tb.TabLabel = Ctrl
            Set tb.ActiveTab = ActiveTab
            Set tb.mForm = mForm
            Set tb.mPage = mPage
            tbCol.Add tb
            
            '                    Set TabLabel = Nothing
        Next
        
        With TabLine
            .Height = LabelTop + 20
            .Top = (mForm.InsideHeight - .Height) / 2
        End With
        
        '//Multipage stil ayarlarý yaparak her sayfaya transition effect ayarlýyoruz
        '//We set the transition effect on each page by making multipage style settings
        With mPage
            .Style = fmTabStyleNone
            .Top = 0
            .Value = 0
            .Left = TabLine.Left + 8
            
            For i = 0 To .Pages.Count - 1
                With .Pages(i)
                    .TransitionEffect = 7        '2 '3
                    .TransitionPeriod = 300
                End With
            Next i
            
        End With
        
    End Sub
    Sub LabelDesign(Ctrl As MSForms.Label)
        With Ctrl
            .Font.Name = "Poppins"
            .Font.Bold = True
            .Font.Size = 11
            .ForeColor = vbGrayText
            .Top = LabelTop
            .Width = 110
            .Height = 20
            .Left = .Left + 25
            .Caption = WorksheetFunction.Proper(.Caption)
            .BackStyle = fmBackStyleTransparent
            '        .BorderStyle = fmBorderStyleSingle
            .TextAlign = fmTextAlignLeft
            
        End With
    End Sub
    Function GetValue(Ctrl As Control, cIndex As Integer)
        On Error Resume Next
        GetValue = Split(Ctrl.Tag, "-")(cIndex)
    End Function
    
    Private Sub TabLabel_Click()
        Dim mPageName As String
        Dim iTag As Integer
        Dim speed As Integer
        
        On Error GoTo err:
        
        '//Label'ýn sýrasý alýnýr
        '//Label's order is taken
        iTag = GetValue(TabLabel, 2) - 1
        
        '//Hangi multipage için çalýþacaðý alýnýr
        mPageName = GetValue(TabLabel, 1)
        
        '//Once tum TabLabellar standart hale getirilir
        '//For which multipage it will work
        TabLabelOut TabLabel
        
        '//aktif olan label iþaretlenir
        '//the active label is marked
        With TabLabel
            .ForeColor = ColorDestaq
            .Font.Name = "Poppins"
            .Font.Bold = True
        End With
        
        If TabLabel = "Logout" Then Unload mForm
        
        '//Multipage'in þu anki deðeri ile atanacak deðeri arasýndaki fark alýnýr ve hýz ayarlanýr
        '//The difference between the current value of Multipage and the value to be assigned is taken and the speed is adjusted
        speed = Abs(iTag - mForm.Controls(mPageName).Value)
        
        With ActiveTab
            Do While .Top < TabLabel.Top - 10
                DoEvents
                .Top = .Top + (0.05 * speed)
            Loop
            
            Do While .Top > TabLabel.Top - 10
                DoEvents
                .Top = .Top - (0.05 * speed)
            Loop
        End With
        '//Multipage value atanýr
        '//Multipage value is assigned
        mForm.Controls(mPageName).Value = iTag
        
    err:
        If err.Number = 380 Then
            MsgBox "You need To add a New page"
        End If
    End Sub
    Sub TabLabelOut(Ctrl As MSForms.Label)
        Dim mPageName As String
        
        '//Formdaki diðer labellarý etkilememesi için sadece MultiPage ismi alýnýr
        '//Only MultiPage name is taken so that it does not affect other labels in the form.
        mPageName = GetValue(Ctrl, 1)
        
        Dim ctr As Control
        For Each ctr In mForm.Controls
            
            If TypeName(Ctrl) = "Label" Then
                '//eðer tag'i Multipage name içerirse, standart hale getirilir
                '//if tag contains Multipage name, it is standardized
                If InStr(1, ctr.Tag, mPageName) <> 0 Then
                    ctr.ForeColor = vbGrayText
                    ctr.Font.Name = "Poppins"
                    ctr.Font.Bold = True
                End If
            End If
        Next
        
    End Sub
    
    Private Sub TabLabel_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
        MouseMoveIcon
    End Sub

    Userform1 Coding
    Code:
    Private Sub UserForm_Initialize()
        ' Ensure the class instance tb is initialized
        Set tb = New ClsTabMenu
        
        ' Ensure MultiPage1 exists before calling CreateTabMenu
        If Not MultiPage1 Is Nothing Then
            tb.CreateTabMenu Me, MultiPage1
        Else
            MsgBox "MultiPage1 could not be found."
        End If
    End Sub


    Module1 coding
    Code:
    Public tb As New ClsTabMenu
    Public tbCol As New Collection
    Attached Files Attached Files
    Last edited by DocAElstein; 10-20-2024 at 09:03 PM.

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Hello Profowo
    I see you have been a member here for almost a year, but this is the first Thread I see of yours, so a belated welcome to ExcelFox from me!

    I am not a super expert in Userforms, so I may be wrong, but I am thinking initially that possibly you are not giving us all the information we need. Perhaps there is some coding or something else missing in your file.
    I say this because I do not understand this ….
    Quote Originally Posted by Profowo View Post
    ....on clicking to load .....
    The file that you have given us has nothing to click on that has anything to do with loading or showing and/ or there is no coding anywhere and/ or nothing to cause your Sub UserForm_Initialize() to run.

    The file that you have given us does nothing, and there is nothing to click on to do anything





    The coding in your file looks to me as if it is at a very advanced level. I have no idea what it is supposed to be doing, so I cannot help much to troubleshoot it.
    But perhaps I can give just a small amount of help.

    If you had this macro in your Module1 coding,
    Code:
    Sub DoSomething()
    Dim MyUserform As UserForm1
     Set MyUserform = New UserForm1
    
    ' MyUserform.Show
    End Sub
    , and ran the macro Sub DoSomething(), then the second line would set off the macro Private Sub UserForm_Initialize() in your Userform1 Coding
    That in turn will cause a macro named Sub CreateTabMenu(form As MSForms.UserForm, muPage As MSForms.MultiPage) in the instance tb of your Class ClsTabMenu







    The coding in your file looks to me as if it is at a very advanced level. I have no idea what it is supposed to be doing, so I cannot help much to troubleshoot it.
    But perhaps I can give just a small amount of help.

    If you had this coding in your Module1,
    Code:
     Public tb As New ClsTabMenu
    Public tbCol As New Collection
    
    Sub DoSomething()
    Dim MyUserform As UserForm1
     Set MyUserform = New UserForm1
    
    ' MyUserform.Show
    End Sub
    , and ran the macro Sub DoSomething(), then the second line would set off the macro Private Sub UserForm_Initialize() in your Userform1 Coding
    That in turn will cause to run a macro named Sub CreateTabMenu(form As MSForms.UserForm, muPage As MSForms.MultiPage) in the instance tb of your Class ClsTabMenu
    That macro will error at the line that I show below in red
    Code:
        With TabLine
            .Height = LabelTop + 20
            .Top = (mForm.InsideHeight - .Height) / 2
        End With
        
    That error is Run-time error "91"
    Object Variable or With block variable not set

    The error occurs because TabLine is Nothing. TabLine is Nothing because it has not been Set to anything

    Further up the macro you do have a code line that does the Set, Set TabLine = mForm.Controls.Add("Forms.Label.1", "TabLine")
    However that is in a For Next section. Specifically it is in the For i = 1 To tempCol.Count section, which is not done. That section is not done, since tempCol.Count appears to be 0. If you try to do a section of For 1 To 0, then it will never be done.



    I cannot give any more help on how to solve that problem as I have no ides what your coding is supposed to be doing. I understand almost none of your coding.


    Alan
    Last edited by DocAElstein; 10-21-2024 at 11:52 AM.

  3. #3
    Junior Member
    Join Date
    Nov 2023
    Posts
    4
    Rep Power
    0
    Thanks Alan,
    If you critically observe the codes,it is meant for Dynamic Menu Page navigation for Label and Multipage with effects. Don't know why the excel sheet is not displaying the form>Maybe you can go to the VBA and check the form with the cls code mod and Userform codes.

    Thank so much for you response

  4. #4
    Junior Member
    Join Date
    Nov 2023
    Posts
    4
    Rep Power
    0
    Pix1.jpgPix 2.png

    @Alan kindly find the screen shot of the UserForm look like

  5. #5
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Hi Profowo
    Thanks for the screenshots.
    I re tried your file on different computers, with Excel versions 2007, 2010, 2013 and 2016, but I still see no UserForm.

    I cannot recognise any coding of yours that would load or show a UserForm, (but that might be because I am not familiar with very advanced coding such as you have)


    Quote Originally Posted by Profowo View Post
    ... Dynamic Menu Page navigation for Label and Multipage with effects.
    I am sorry, but I have no experience, knowledge or understanding of those things.



    Perhaps someone else may be able to help you.


    If you are unable to get help here, you could also try to get help at forums
    ExcelForum
    or
    MrExcel



    ( Please remember if you post the same question in other forums, that most forums have a "cross posting rule", which requires that you tell them where else you have posted the same question. )


    Alan




    P.S. This is what I see in the VB Editor for your UserForm1
    UserForm1.jpg
    Last edited by DocAElstein; 10-21-2024 at 05:14 PM.
    A Folk, A Forum, A Fuhrer ….

  6. #6
    Junior Member
    Join Date
    Nov 2023
    Posts
    4
    Rep Power
    0

    VBA USERFORM NOT LOADING GIVING ERROR MESSAGE 13

    PM message from Profowo on me, (DocAElstein) :
    VBA USERFORM NOT LOADING GIVING ERROR MESSAGE 13

    Thank you for you reply on my last post for help.I need you urgent help the error I have.You can get the excel sheet and information to view the user-form on the platform,I could not attach it here
    .I have Error 13

    Thank you in advance sir









    Below is the control names and properties and codes I created--Please find attached


    Frame1 is having the menu & submenus inside

    Menu1 is main menu has inside lbl as Dashboard
    Menu2 is main menu has inside lbl as Employee_Main as property name and Employee as caption name

    Menu3 is main menu has inside lbl as Payroll_Main as property name and Payroll as Caption name

    Menu 4 is main has inside lbl as Reports_Main as property name and Reports an Caption name

    Menu5 is main menu has inside lbl as Settings_Main as property name and Settings as caption name

    Menu1 (has no submenu)


    Frame2 property name has menu2 inside with submenus named
    E_sMenu1. Caption as Add New
    E_sMenu2 caption as Edit
    E_sMenu3 caption as Disciplinary
    E_sMenu4 caption as leave management

    Frame3 as property name has menu3 inside with submenus named
    P_sMenu1 created payroll as caption name
    P_sMenu2 process payroll as caption name
    P_sMenu3 loan deductions as caption name
    P_sMenu4 salary review as caption name
    P_sMenu5 payslip as caption name

    Frame4 as property name has menu4 inside with submenus named
    R_sMenu1 payroll report as caption name
    R_sMenu2 employee report as caption name
    R_sMenu3 deduction report as caption name
    R_sMenu4 PAYE report as caption name
    R_sMenu5 Pension report as caption name
    R_sMenu6 NHF report as caption name

    Frame5 as property name has menu5 inside with submenus named
    S_sMenu1 setup as caption
    S_sMenu2. Other setting as caption

    4 pane Beside each menu named
    Pane1
    Pane2
    Pane3
    Pane4

    Drop Arrow up & down Arrow for each main menu 2 to main menu 5 are as below

    Img_DpUp. Img_DpDown
    Img_DpUp Img_DpDown
    Img_DpUp Img_DpDown
    Img_DpUp Img_DpDown


    Code:
    Option Explicit
    
    Private IsEmployeeExpanded As Boolean
    Private IsPayrollExpanded As Boolean
    Private IsReportsExpanded As Boolean
    Private IsSettingsExpanded As Boolean
    
    Public Sub SetMenuEvents(menuFrame As MSForms.Frame, _
    dpUp As MSForms.CommandButton, _
    dpUDown As MSForms.CommandButton, _
    subMenus As Collection, _
    ByRef IsExpanded As Boolean, _
    framesBelow As Collection, _
    pane As MSForms.frame)
                            
                            
                            
    On Error GoTo ErrorHandler
    Debug.Print "IsExpanded Initial State: " & IsExpanded
    Debug.Print "Submenus Count: " & subMenus.Count
    Debug.Print "Frames below Count: " & FrameBelow.Count
    Debug.Print "Pane visible: " & pane.Visible
       
       
       
    'toggle visibility based on IsExpanded state
    If IsExpanded Then
    'Hide subMenus
    Dim ctrl As MSForms.Control
    For Each ctrl In subMenus
    ctrl.visible = False
    Next ctrl
    pane.visible = False 'Hide the pane associated with this menu
    dpUp.visible = False
    DpDown.visble = True
    IsExpanded = False
    Else
    'Show subMenu
    For Each ctrl In subMenu
    ctrl.visible = True
    Next ctrl
    pane.visible = True 'Show the pane associated with this menu
    dpUp.visible = True
    DpDown.visble = False
    IsExpanded = True
    End If
    
    'Adjust frame below based on expansion state
    Dim frm As MSForms.frame
    Dim offset As Long
    offset = IIf(IsExpanded, 100, -100) 'adjust this value as neededfor spacing
    
    
    For Each frm In framesBelow
    frm.Top = frm.Top + offset
    Next frm
    
    ErrorHandler:
    MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical, "Error in SetMenuEvents"
    
    End Sub


    Code:
    Private Sub UserForm_Initialize()
    ' Initialize expand/collapse states
    IsEmployeeExpanded = False
    IsPayrollExpanded = False
    IsReportsExpanded = False
    IsSettingsExpanded = False
       
    ' Initialize each menu's submenus and set hover effects
    InitializeMenu
    ' Add hover effects for all main menus
    AddHoverEffect menu1
    AddHoverEffect Frame2
    AddHoverEffect Frame3
    AddHoverEffect Frame4
    AddHoverEffect Frame5
    
    ' Hide all submenus initially
    ToggleVisibility Frame2, False
    ToggleVisibility Frame3, False
    ToggleVisibility Frame4, False
    ToggleVisibility Frame5, False
    End Sub
    Code:
    Private Sub InitializeMenu()
    ' Initialize each menu with its submenus, frames that are positioned below it, and panes
    Dim employeeSubMenus As Collection
    Dim payrollSubMenus As Collection
    Dim reportsSubMenus As Collection
    Dim settingsSubMenus As Collection
       
    Set employeeSubMenus = New Collection
    employeeSubMenus.Add Me.E_sMenu1
    employeeSubMenus.Add Me.E_sMenu2
    employeeSubMenus.Add Me.E_sMenu3
    employeeSubMenus.Add Me.E_sMenu4
       
    Set payrollSubMenus = New Collection
    payrollSubMenus.Add Me.P_sMenu1
    payrollSubMenus.Add Me.P_sMenu2
    payrollSubMenus.Add Me.P_sMenu3
    payrollSubMenus.Add Me.P_sMenu4
    payrollSubMenus.Add Me.P_sMenu5
       
    Set reportsSubMenus = New Collection
    reportsSubMenus.Add Me.R_sMenu1
    reportsSubMenus.Add Me.R_sMenu2
    reportsSubMenus.Add Me.R_sMenu3
    reportsSubMenus.Add Me.R_sMenu4
    reportsSubMenus.Add Me.R_sMenu5
    reportsSubMenus.Add Me.R_sMenu6
       
    Set settingsSubMenus = New Collection
    settingsSubMenus.Add Me.S_sMenu1
    settingsSubMenus.Add Me.S_sMenu2
    
    ' Set up frames to move
    Dim framesBelowEmployee As Collection, framesBelowPayroll As Collection, framesBelowReports As Collection
       
    Set framesBelowEmployee = New Collection
    framesBelowEmployee.Add Me.Frame3
    framesBelowEmployee.Add Me.Frame4
    framesBelowEmployee.Add Me.Frame5
    
    Set framesBelowPayroll = New Collection
    framesBelowPayroll.Add Me.Frame4
    framesBelowPayroll.Add Me.Frame5
    
    Set framesBelowReports = New Collection
    framesBelowReports.Add Me.Frame5
    
    ' Configure each menu and submenu with panes
    SetMenuEvents Me.Frame2, Me.Img_DpUp, Me.Img_DpDown, employeeSubMenus, IsEmployeeExpanded, framesBelowEmployee, Me.Pane2
    SetMenuEvents Me.Frame3, Me.Img_DpUp, Me.Img_DpDown, payrollSubMenus, IsPayrollExpanded, framesBelowPayroll, Me.Pane3
    SetMenuEvents Me.Frame4, Me.Img_DpUp, Me.Img_DpDown, reportsSubMenus, IsReportsExpanded, framesBelowReports, Me.Pane4
    SetMenuEvents Me.Frame5, Me.Img_DpUp, Me.Img_DpDown, settingsSubMenus, IsSettingsExpanded, New Collection, Me.Pane5 ' No frames below Setting
    End Sub

    Code:
    ' Module to handle hover effect
    Public Sub AddHoverEffect(ctrl As Control, Optional hoverColor As Long = &HFFDD99, Optional defaultColor As Long = &HFFFFFF)
    ctrl.BackColor = defaultColor
    ctrl.OnMouseMove = "HoverEffect", hoverColor
    End Sub
    Code:
    Public Sub RemoveHoverEffect(ctrl As Control, Optional defaultColor As Long = &HFFFFFF)
    ctrl.BackColor = defaultColor
    End Sub
    Code:
    ' Module for handling dropdown menu visibility
    Public Sub ToggleVisibility(frame As frame, visible As Boolean)
    Dim ctrl As Control
    For Each ctrl In frame.Controls
    If TypeName(ctrl) = "Label" Then
    ctrl.visible = visible
    End If
    Next ctrl
    End Sub
    Code:
    ' Main Menu Hover Events
    Private Sub Menu1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    HoverEffect Menu1, &HFFDD99
    End Sub
    Code:
    Private Sub Frame2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    HoverEffect Frame2, &HFFDD99
    End Sub
    Code:
    Private Sub Frame3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    HoverEffect Frame3, &HFFDD99
    End Sub
    Code:
    Private Sub Frame4_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    HoverEffect Frame4, &HFFDD99
    End Sub
    Code:
    Private Sub Frame5_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    HoverEffect Frame5, &HFFDD99
    End Sub
    Code:
    ' Arrow Button Click Events
    Private Sub DpDown_Employee_Click()
    ToggleVisibility Frame2, True
    End Sub
    Code:
    Private Sub DpUp_Employee_Click()
    ToggleVisibility Frame2, False
    End Sub
    Code:
    Private Sub DpDown_Payroll_Click()
    ToggleVisibility Frame3, True
    End Sub
    Code:
    Private Sub DpUp_Payroll_Click()
    ToggleVisibility Frame3, False
    End Sub
    Code:
    Private Sub DpDown_Reports_Click()
    ToggleVisibility Frame4, True
    End Sub
    Code:
    Private Sub DpUp_Reports_Click()
    ToggleVisibility Frame4, False
    End Sub
    Code:
    Private Sub DpDown_Setting_Click()
    ToggleVisibility Frame5, True
    End Sub
    Code:
    Private Sub DpUp_Setting_Click()
    ToggleVisibility Frame5, False
    End Sub
    Code:
    Public Sub HoverEffect(ctrl As Control, hoverColor As Long)
    ctrl.BackColor = hoverColor
    End Sub
    Code:
    Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ' Reset to default colors when not hovering
    RemoveHoverEffect menu1
    RemoveHoverEffect Frame2
    RemoveHoverEffect Frame3
    RemoveHoverEffect Frame4
    RemoveHoverEffect Frame5
    End Sub
    Attached Files Attached Files
    Last edited by DocAElstein; 11-12-2024 at 03:48 PM. Reason: Added code tags ... - [code] your code goes here [/code]

  7. #7
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Hi
    Sorry, I still have no idea what your problem is.
    I do not understand what question you are asking.
    Once again, I see no UserForm on your Excel Worksheet. I see nothing on your Excel Worksheet


    If I make this extra coding and run it

    Code:
    Sub DoSomething()
    Dim MyUserform As UserForm1
     Set MyUserform = New UserForm1
    
    ' MyUserform.Show
    End Sub
    , I then get error here



    But I have no idea why.
    Your coding is much too complicated and much too advanced for me to understand.
    I really have no idea what your file is about or what your file is supposed to be doing


    Alan
    Attached Files Attached Files

Similar Threads

  1. Replies: 51
    Last Post: 10-22-2022, 01:47 PM
  2. Displaying dates in reports as MM/DD
    By papabill in forum Access Help
    Replies: 1
    Last Post: 02-26-2015, 06:16 AM
  3. UserForm ComboBox error
    By Jabba89 in forum Excel Help
    Replies: 4
    Last Post: 12-20-2014, 03:54 AM
  4. How To Bypass A Webquery Error Message
    By mrprofit in forum Excel Help
    Replies: 4
    Last Post: 04-17-2014, 06:39 PM
  5. Replies: 8
    Last Post: 05-21-2013, 06:34 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •