Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

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).


Check out our Excel VBA Resources

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

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.

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.