Environ () Function

A

Ayo

Can someone explain to me how the Environ () works. I saw it been used in
another example code here as follows:

Private Sub Workbook_Open ()
Dim myB as Workbook
If Environ("COMPUTERNAME") = "janphi" Then

I tried to use the same concept for my code:

If Environ("COMPUTERNAME") = "Work_Laptop" Then
Else
InputForm1.Show
End If

but the InputForm1 still come up. I want InputForm1 to only load when
someone else opens the file but when I open the file from my computer, I
don't want it to open. That is what I am trying to accomplish.
Any ideas?
 
J

Jacob Skaria

Ayo

Try the below in your immediate window and compare the name with what you
have given "Work_Laptop"

?Environ("COMPUTERNAME")

I would suggest to use Environ("USERNAME") .

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top