+ Reply to Thread
Results 1 to 6 of 6

Use text file to hold usernames and then VBA to read the file to check if the user is list

  1. #1
    Registered User
    Join Date
    10-07-2012
    Location
    Lincoln
    MS-Off Ver
    Excel 2003
    Posts
    3

    Angry Use text file to hold usernames and then VBA to read the file to check if the user is list

    I'm trying to create an excel workbook that when opened, looks at a text file to check the environ("username") exists in the text file. My vba skills are quite good, but have never had to do anything referring to another file.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Use text file to hold usernames and then VBA to read the file to check if the user is

    Why not simply store the list on a very hidden worksheet in the workbook itself...?

    Would make things a whole lot simpler.

  3. #3
    Registered User
    Join Date
    10-07-2012
    Location
    Lincoln
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Use text file to hold usernames and then VBA to read the file to check if the user is

    cytop, thanks for the reply - yes I did think about it. However, I will eventually have a vast number of workbooks that will require the username check and I will need to add users to the list over time.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Use text file to hold usernames and then VBA to read the file to check if the user is

    Then again, you may want to maintain the file outside of Excel... *

    To prevent a name like 'Vic' matching 'Victor', each name should be on it's own line with a space before and after. The
    Please Login or Register  to view this content.
    statement is also required. This goes at the top of the module the function is added to and makes text comparisons case insensitive.

    Please Login or Register  to view this content.
    It's a simple call to check:

    Please Login or Register  to view this content.
    ______________________________________________________________

    * Always helps to think things through (me, that is)

  5. #5
    Registered User
    Join Date
    10-07-2012
    Location
    Lincoln
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Use text file to hold usernames and then VBA to read the file to check if the user is

    Cytop, many thanks for your invaluable help. With a slight tweek, this code has worked perfectly. Thank you.

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Use text file to hold usernames and then VBA to read the file to check if the user is

    Slight tweak was to name the Name file with the same root name of the workbook so that each workbook has its own list of names?

+ 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. Importing text file. Does entire file get read into memory first?
    By sumdumgai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2016, 07:28 PM
  2. Importing a data from a text file - user-defined file
    By DaveSev in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2013, 07:02 PM
  3. Check list of usernames in Active Directory
    By tgschaef in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2012, 08:09 AM
  4. Read text file to ListBox and Delete rows in ListBox and re-write text file
    By Nu2Java in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-29-2012, 09:42 AM
  5. Read whole file,Match the headers based on specific condition & write to text file
    By macromaniac in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-07-2011, 06:37 AM
  6. read value of strings from a text file and make an excel file.
    By gashforing in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2009, 07:12 AM
  7. Using a text file to hold sequential numbers
    By spanker in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-15-2009, 03:58 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