Results 1 to 20 of 97

Thread: Solved: Only running MyExcel.xls on named machine?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    LOL!

    I did set up a select case, referencing results from function calls to other modules, yes.

    With regards to the Public statement... all of your subs and functions are by default Public. I don't need to declare them with the Public keyword, but I prefer to code to make things obvious. So long as they are public, they are available to all the other modules. If you declare them as Private, though, then they are restricted to within that module only.

    The Enum is a way of declaring your own constants. (Sort of like vbOkOnly is a constant). It basically lets VBA know that when you see, say "us_uNameWrong" in the code, that it's equal to 2. It can make your code a little more legible than trying to figure out what UserStatus = 2 is. In addition, if you declare your functions using the term, then it adds it to intellisense for you. So:

    Function TellMeAboutThis(SomeInfo as Userstatus) as Boolean
    Would allow you to have intellisense give you the list of values when you were plugging the function into code somehwere. The following (which is equivalent) would not:
    Function TellMeAboutThis(SomeInfo as Long) as Boolean
    Just to clarify, though, the fact that the Enum exists is what allows it to work this way, not the fact that it is Public. The Public portion just allows us to make use of it across modules. If it were a Private Enum, we'd only be able to use it in Module1 (or wherever we put it)

    Now, with the roaming users... if you have some users that are legitimately allowed to roam, we could add a loop to check all records returned from the database. You'd need to add each workstation that they could use though. This would also benefit if you have shared desks as well.

    On the 27 different workbooks... let me think on that one for a bit. There's a couple of ways that we could look at it, I'm just trying to think of the best one.
    Last edited by Aussiebear; 03-11-2025 at 06:09 PM.
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





Posting Permissions

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