MrExcel Publishing
Your One Stop for Excel Tips & Solutions

a hard one: asking the name to computer. Protecting macros


Posted by Pablo Manterola on March 14, 2001 5:40 AM

Hello.

I want to include in my macro a "if" sentence that
ask the computer's name, and does different things
according to it.
Something like:

if computer.name="PC_Home" then
subrutine1()
elsif computer.name="PC_Office" then
subrutine2()
else
ask_passwd()
endif

I thing there would be something like "computer.name"
or, at less, more elegant that read a text file
with a name (the second-best alternative).


Posted by Mark W. on March 14, 2001 7:07 AM

Pablo, you may be able to distinquish between your
home and office systems by the "User name" or the
pathname of the "Default file location" fields
that a found on the Tools Options... General tab.