Results 1 to 10 of 30

Thread: Class related Stuff Userforms

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Code for last post with a few more explaining Comments and colour conventions to suit the last Posts # 16 and #17 ( Posted here due to Forum Post size limitations: )


    oRefiginal Class UserForm1.
    Code:
    Sub KloneAUserFormWonks()   '         ' Post #16  http://www.excelforum.com/showthread.php?t=1138300&p=4383265&highlight=#post4383265
    Dim ws As Worksheet             '     ' Preparing a "Pointer" to an Initial "Blue Print" ( or a Form, or a Questionnaire not yet filled in, a template   etc.) in Memory of the Object ( Pigeon Hole with a bit of paper or code lines on that can be filled in to refer to a specific Object of this type ) . This also us to get easily at the Methods and Properties through the applying of a period ( .Dot) ( intellisense )
    Set ws = ThisWorkbook.Worksheets.Item(1)        ' Values are filled at the memory locations and the directions there are specified in the variable "Blue Print "Pointer". In this case a Filled in Blue Print is passed. This is the one used on Opening by Excel to call up the user Friendly Form of the Fiist Tab Worksheet counting from the left.
    Dim fm1 As UserForm1 '
    Set fm1 = New UserForm1  '                                                                        ' A copy of the Blue Print is made
    fm1.Left = 0
    fm1.CheckBox1.Value = True
    fm1.Show vbModeless         '         there are two ways ( modes ) of showing a form in vb - modal and modeless. a modal form takes the focus and won't return control to the calling module until it is closed. a modeless form is shown and then control is immediately returned to the calling module.     http://vbcity.com/forums/t/53342.aspx
    Dim fm2 As UserForm1
    Set fm2 = New UserForm1
    fm2.Show vbModeless
    fm2.Caption = "Klone fm2"
    fm2.Left = 50
        '    Dim UserForm1 As UserForm1     ' These two imaginary lines are effectively done by
        '    Set UserForm1 = New UserForm1  ' VBA on compile when it sees the next line. Thes lines you would never see
    UserForm1.Caption = "This one VBA decalred and Instanced for me"
    UserForm1.Show vbModeless
    UserForm1.Height = 50
    UserForm1.Left = 200
    End Sub
    Last edited by DocAElstein; 06-01-2024 at 08:00 PM.

Similar Threads

  1. Class Stuff: VBA Custom Classes & Objects, Class Modules
    By DocAElstein in forum Excel and VBA Tips and Tricks
    Replies: 29
    Last Post: 06-02-2024, 01:49 PM
  2. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  3. Test my rights , to do stuff
    By TestAccount in forum Test Area
    Replies: 0
    Last Post: 10-07-2020, 11:49 AM
  4. Backup all modules, class modules and userforms to a selectable folder
    By MrBlackd in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 04-06-2014, 08:33 AM
  5. Pass Values Between Multiple Userforms
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 07-24-2011, 03:25 AM

Posting Permissions

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