Results 1 to 10 of 23

Thread: Class related Stuff New Instancing

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

    Answer from buran

    https://www.excelforum.com/excel-pro...ml#post4383957
    https://www.excelforum.com/excel-pro...ml#post4383975
    https://www.excelfox.com/forum/showt...ll=1#post24202





    Quote Originally Posted by buran View Post
    To be hones, not sure I understand your question
    the code should be

    Code:
    Sub example()
        Dim ws As Worksheet
        Set ws = Worksheets.Add 'ActiveWorkbook is assumed by default, also the new ws is added at the end, but you can specify after or before specific sheet
        MsgBox ws.Name 'Just an example for use of the ws variable/object
    End Sub
    Quote Originally Posted by Doc.AElstein View Post
    Hi buran,
    Thanks for the reply.
    That is not really what I am talking about.

    I understand what you have explained.
    You are using the Worksheets Method .Add to make a new sheet..
    I have no problem with either making a new, or copying an existing, Worksheet.

    I am talking more generally about VBA Classes, Objects, and the different way one instances those. ( I am not trying to create or add a Worksheet with
    Set ws = New Worksheet
    - This is a code line recognised by VBA ( via intellisense ) which from Syntax appears correct to set a new instance from the VBA Class Worksheets. The line is not necerssary. But I am ( was ) puzzled that in errors. My point was that it I expected that VBA allowed it not to be written, but that it was an implied code line, an Implied Default. As such I should be alowed to enter it. Or so i thought
    ; ) )

    So what I am talikng about is something quite different

    I am talikng about advanced ( slightly ) VBA Theory.

    I am looking for "Help Understanding Class Instancing"

    But thanks anyway for the Reply. Appreciate the effort.

    Alan
    Last edited by DocAElstein; 06-04-2024 at 12:52 AM.

Similar Threads

  1. Class related Stuff Userforms
    By DocAElstein in forum Test Area
    Replies: 29
    Last Post: 06-08-2024, 01:22 PM
  2. 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
  3. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  4. Gif Image Video stuff testies
    By DocAElstein in forum Test Area
    Replies: 13
    Last Post: 09-06-2021, 01:07 PM
  5. Test my rights , to do stuff
    By TestAccount in forum Test Area
    Replies: 0
    Last Post: 10-07-2020, 11:49 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
  •