View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default How to return the machine name?

Maury Markowitz pretended :
Hey everyone,

I'm back into VBA programming after a long hiatus, and this time I'm
on the Mac just to make things confusing and difficult to debug :-)

My current problem is a simple one: we have a DB on a virtual server
and I'd like the VBA to only run when opened on that machine (via
RDP). Google fails to reveal an easy way to test if I'm running on a
particular machine - is there one?


You could try...

If Not Environ("ComputerName") = <ServerName Then _
ThisWorkbook.Close SaveChanges:=False

...where you substitute your actual server's computer name in the
(obvious) placeholder above.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion