CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 1999
    Posts
    45

    Excel Object Library

    Hi

    I want to append 1 more Sheet to my Workbook.
    And I have trouble using :

    dim MyWorkbook as Workbook
    MyWorkbook.Worksheets.Add ([Before],[After],[Count],[Type]) as Object

    What am I supposed to pass to [Before] or [After] ?

    Thanks






  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Excel Object Library

    these are all optional parameters. So, you can just omit them:
    Set ws = ...WorkSheets.Add


  3. #3
    Join Date
    Aug 1999
    Posts
    45

    Re: Excel Object Library

    Thanks for the reply.

    The thing is I want to add my sheet to the end of the existing Sheets.
    If I omit those optional parameters, my sheet will added infront of the
    existing ones. I'm sure there 's something to do with with those [Before],[After] parameters.





  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: Excel Object Library

    OK, here is a sample from the online docs:
    Worksheets("Sheet1").Move After:=Worksheets(Worksheets.Count)




  5. #5
    Join Date
    Aug 1999
    Posts
    45

    Re: Excel Object Library

    Thanks, it works !


  6. #6
    Join Date
    Aug 1999
    Posts
    45

    Re: Excel Object Library

    Lothar,
    Can you tell me where that online docs are, I still have a
    small problem with that Sheet insertion.

    The first insertion and move is OK.
    But right second insertion, seems like the move is executed automatically
    with the old "Worksheets.count"


    Thanks


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured