Results 1 to 4 of 4

Thread: How to call a macro in Excel when creating a new sheet or file

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Location
    Dist 2, Ho Chi Minh City,Viet Nam
    Posts
    13

    How to call a macro in Excel when creating a new sheet or file

    Hi,

    In excel when creating new file (Ctr+N) or new sheet I'd like to call a macro in Personal Workbook.
    Is there anyone can help ?

    In fact the macro i'd like to call is a macro to format the sheet (just been created) as I wish.

    Thank a lot.

    Cheers

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    WORKBOOK
    1. You could have a pre-formatted template
    2. Why not just add a toolbar button to create the new workbook and format or copy the template.

    3. Putting a pre-formatted workbook into your XLSTART folder and calling it book.xlt will do the job - but you might not need this for every new book.

    WORKSHEET
    Doubleclick ThisWorkBook in VB Editor and use the NewSheet event. (include this code in your template).

    '----------------------------------------
    Private Sub Workbook_NewSheet(ByVal Sh As Object)

    End Sub
    '------------------------------------------
    Regards
    BrianB
    -------------------------------

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Location
    Dist 2, Ho Chi Minh City,Viet Nam
    Posts
    13
    Thank you for your clear post.

    However, I've found a way to create a default template.
    It is : I create a file , format as I wish then Save as a template to the location , for example :
    C:\Documents and Settings\chien\Application Data\Microsoft\Excel\XLSTART\Book.xlt

    The Every time I create a new Workbook It'll have the same format as the template.

    Thank again.

    Cheers
    Chien

  4. #4
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    ... which is included in my post .... <<grin>>.
    Regards
    BrianB
    -------------------------------

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