+ Reply to Thread
Results 1 to 6 of 6

code to check if user opened correct file

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    code to check if user opened correct file

    I am trying to display and check if a user is using the correct version of a file. I keep getting an error on "Workbooks.Filename" and can't figure out how to modify code. Thanks.

    Please Login or Register  to view this content.
    Last edited by maacmaac; 11-26-2010 at 12:12 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: code to check if user opened correct file

    Where would you place a code like this?

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: code to check if user opened correct file

    Hi maacmaac

    This works for me
    Please Login or Register  to view this content.
    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    Re: code to check if user opened correct file

    John,

    Suggestion almost worked. If the workbook name is "Book2", the ActiveWorkbook.Name = "Book2". The ActiveWorkbook.Name is only recognizing the name of the workbook not the full path name. Is there a way to modify so it also reads the full path name?

    Dave,

    I am trying to prevent prying eyes from copying my file and placing a copy on another server for their own personal use. As an example, say my file is located on "O:/Department ABC/MetricsApplication.xls". I'm trying to prevent users from other departments copying my file and using it for their own use. So if someone were to copy my file to "O:/Department XYZ/MetricsApplication.xls", I want to prevent the file from opening. In a nutshell, if the file being opened is not located on "O:/Department ABC/MetricsApplication.xls", then don't open the file.

  5. #5
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    Re: code to check if user opened correct file

    Just figured it out...use "ActiveWorkbook.FullName" instead of "ActiveWorkbook.Name"
    Please Login or Register  to view this content.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: code to check if user opened correct file

    Yes...realized that when I read your last post...need to pick up FULL path and filename. Good detective work.

    John

+ 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