Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    check a file name follows naming convention

    Hi folks

    I am setting up a template workbook that various people are going to them take and put data in each day. Each day the workbook will be saved at in various folders, likely one per user.

    I want to force each user to follow a naming convention for the file name

    Day day year year_sheet_location_originator

    DDYY_SHEET_city_local or
    DDYY_SHEET_city_National

    is there a script that can automatically run after a save event (not autosave) that can check the file name they just used and pop up a warning that the file name did not follow the naming convention?

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Iruser3,

    Welcome to the lounge.

    Since you're creating a template why not include an Auto_Open() macro that pulls the appropriate date information from the system, and prompts the user to provide the other information then constructs the file name and saves the sheet before they do anything. Then when the actually save the completed sheet it is already named. You could also pull the user name from the system to determine the directory in which to save the file. The macro should also check to see if the file is already named and exit immediately for when the sheet is opened subsequently.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    New Lounger
    Join Date
    Feb 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    Iruser3,

    Welcome to the lounge.

    Since you're creating a template why not include an Auto_Open() macro that pulls the appropriate date information from the system, and prompts the user to provide the other information then constructs the file name and saves the sheet before they do anything. Then when the actually save the completed sheet it is already named. You could also pull the user name from the system to determine the directory in which to save the file. The macro should also check to see if the file is already named and exit immediately for when the sheet is opened subsequently.


    thanks for the welcome, but iruser and iruser2 are me as well, I just cant seem to get them to work, and the emails they had are dead accounts now so cannot gett password / userid reminder mail.

    Good suggestion on the macro / script. The user has a drop down to tell us which business unit they are with and another field for which date they are entering data, we could move those to macro based questions on open. The rest should be preset.

    do you think i need to check save as events as well?

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Quote Originally Posted by iruser3 View Post
    do you think i need to check save as events as well?
    If you setup your Auto_Open() correctly and immediately save the file as soon as you have all the required information to generate the name there should be no need to check again.

    Don't forget to include code at the beginning of the Auto_Open() to get around all the questions and save command it it has already been named!
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

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