Consulting

Results 1 to 4 of 4

Thread: Template-document new equivilant in Excel

  1. #1
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location

    Template-document new equivilant in Excel

    I have Excel files I wish to use as templates that contain code....If I create a new file using the template the code is included.

    Gerry has been discussing a resolution to this problem in Word and I was wondering if there is an equivilant to document_New in excel. No results from searching.

    Gerry's word thread: http://www.vbaexpress.com/forum/show...6228#post66228
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Steve
    Why not save your code in an XLA file
    Regards
    Malcolm
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Sounds like my best bet so far Malcolm. Thanks for the tip
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I have been using this on workbook open:
    [vba]
    Private Sub Workbook_Open()
    ActiveWorkbook.SaveAs FileName:="F:\Temp\BOM.xls", FileFormat:=xlNormal, _
    Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
    CreateBackup:=False
    Application.Run "checkname"
    End Sub
    [/vba]

    Then I have a sheet with a button to run code to:

    get a directory file listing,
    combine files in the directory into this workbook,
    sort sheets(at the end of the sort routine I run a delete code and sheet routine)

    so the end result is a file I can email. I just have been going through the process of copying the workbook each time...run the code....delete the code and sheet...ready to go. Sounds really busy doesn't it?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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