Results 1 to 7 of 7

Thread: VBA USERFORM NOT LOADING dISPLAYING ERROR MESSAGE

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #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.

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
  •