+ Reply to Thread
Results 1 to 5 of 5

Auto run macro on File->New->Template

  1. #1
    Registered User
    Join Date
    10-25-2007
    Posts
    35

    Auto run macro on File->New->Template

    Hi,

    Just quickly - I'm trying to make a template that displays a form when a user first creates a new file from it. At the moment, the macro that I'm using runs the form whenever the document is opened:

    Please Login or Register  to view this content.
    Thanks,

    Owain
    Last edited by VBA Noob; 08-04-2008 at 08:57 AM.

  2. #2
    Registered User
    Join Date
    10-25-2007
    Posts
    35
    OK, so I've been reading about this and it now seems I should be using the following:

    Please Login or Register  to view this content.
    Still need help making it run only once though.

  3. #3
    Registered User
    Join Date
    10-25-2007
    Posts
    35

    Cool

    Bump-a-rooney

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    That code will display the form on opening. You need the form & relevant code in the workbook then save it as a template (*.xlt) See

    http://www.excel-it.com/excel_templates.htm

    If you don't want it to show you would need to store some check in an inaccessible place, on a hidden sheet perhaps.
    Please Login or Register  to view this content.
    Last edited by royUK; 08-06-2008 at 04:54 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    10-25-2007
    Posts
    35
    Cheers - smart thinking! The option I actually went for (which has now been sent out to the whole of my department, making all this a bit academic) was to have the module that loads the form delete itself afterwards. The only disadvantage of this method is that it requires users to allow Programmatic Access to VBA, thereby exposing them to a risk of virus.

    I'll bear this better version in mind though and add it to the next update.

    Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1