2 Replies Latest reply on Mar 14, 2018 10:56 AM by Christian Chu

    User Form not showing?

    John Boire

      Okay so here is my issue:

       

      I made a form named "UserForm1"

       

      then in my Sub main() I have the following line:

       

      Dim Form As Object

      Set Form = New UserForm1

      Form.Show

       

      When I run this macro to test it I get "Object required" error
      I have also done the following variations

       

      Dim Form As New UserForm1

      Form.Show

      &

      Dim Form As New UserForm1

      Set Form = New UserForm1

      Form.Show

       

      I also thought that maybe there was a corruption or something of the form so I basically copied all the contents onto a new userform and let vba name it automatically but I am still getting the same error.

        • Re: User Form not showing?
          John Boire

          Well I fixed it,

          I had this line copied from my previous userform

          ______________________________

          Private Sub UserForm_Initialize()

             

              Dim i As Integer

          '    UserForm.Show

              For i = 0 To ConfigNumber - 1

                  StartBox1.AddItem (ConfigNamesArray(i))

              Next i

             

              ExceptionsBox2.MultiSelect = fmMultiSelectMulti

             

          End Sub

          _______________________________

           

          should have been:
          Private Sub UserForm1_Initialize()

          ect

          End Sub

          • Re: User Form not showing?
            Christian Chu

            You can show form with simple code

            Dim swApp As Object
            Sub main()
            Set swApp = Application.SldWorks
            UserForm1.Show modeless
            End Sub