+ Reply to Thread
Results 1 to 3 of 3

Only allow worksheet to change if filename is not (for example) Template.xlsm

  1. #1
    Registered User
    Join Date
    10-17-2014
    Location
    Wausau, WI
    MS-Off Ver
    2014
    Posts
    17

    Only allow worksheet to change if filename is not (for example) Template.xlsm

    I have a template that everyone at work uses for filling out purchase orders. It has a built in contact list that is opened through a userform and is constantly being updated. The contact list is on say sheet4. Every once in a while users will accidentally fill out information and save over the master file. Is there a way to only allow changes to be made and saved on one worksheet but not save any of the changes on the other?

    I think if there is a way to check what the filename is and if it is (for example) template.xlsm then do not allow certain macros or cells to be executed/changed but if they fill out some info and change the filename to (for example) template-0045.xlsm then allow changes.
    This would act just like it is read only but a little different I guess.

    Any help would be appreciated on this one!

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Only allow worksheet to change if filename is not (for example) Template.xlsm

    Would If FileSaveName = Template.xlsm Then...... I don't know exactly what to put after the "Then" part, but maybe this will be of some help to you
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    09-27-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: Only allow worksheet to change if filename is not (for example) Template.xlsm

    hi,

    Use the workbook event procedure.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    If ThisWorkbook.Name = "text to raw.xlsm" Then
    MsgBox "Please change the filename"
    Cancel = True
    End If

    End Sub

    regards,
    lokicl

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 10-15-2014, 09:07 AM
  2. [SOLVED] Excel 2007 macro Save .xlsm as .PDF using a cell value in the filename
    By cmartel815 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-02-2014, 12:09 PM
  3. [SOLVED] Excel found unreadable content in filename.xlsm'. do you want to recover.....
    By cedia2545 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2014, 01:20 PM
  4. VBA to: Look in folder for .xlsm file, and list its filename in cell
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-19-2013, 11:51 PM
  5. Worksheet Change Macro without .xlsm extension
    By alexwgordon in forum Excel General
    Replies: 2
    Last Post: 08-25-2011, 08:33 PM

Tags for this Thread

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