Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default How to make Computer name as a Password by VBA

Dear All,
I 've made a program in which if the user click a button a userform will
form and it will ask for a Password.
Person should write Password in the textbox in Userform.
I want to accept the password of the Computer name (Log in name).
Will anyone help me how to sort out.

Thanks
Prem.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default How to make Computer name as a Password by VBA

Hi,

because you don't give too much detail it's hard to be precise but this may
get you going in the right direction.

Private Sub CommandButton1_Click()
response = InputBox("Enter password")
If response < Environ("Username") Then
MsgBox "Incorrect, You must enter you logon username"
Else
MsgBox "Password accepted"

End If
End Sub

Mike

"Premanand Sethuraman" wrote:

Dear All,
I 've made a program in which if the user click a button a userform will
form and it will ask for a Password.
Person should write Password in the textbox in Userform.
I want to accept the password of the Computer name (Log in name).
Will anyone help me how to sort out.

Thanks
Prem.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default How to make Computer name as a Password by VBA

Dear Mike,
Thanks for your reply.
I used the Environ Functrion in my coding as per your suggestions but it is
still saying "Incorrect Password"
My computer name is "env_mktl_prem"
Is it because of "Underscore" sign it is showing "Incorrect Password"?
THis is my coding

Private Sub CommandButton1_Click()
Dim myfile As String
Dim c As Range
Set c = Worksheets("Technical offer").Range("A7")
myfile = ActiveWorkbook.Name
If TextBox1.Text < Environ("Username") Then
UserForm1.Hide
MsgBox ("Incorrect Password")
Else
If c = 0 Then
MsgBox ("Please Enter the data of BagFilter and then use this button for
generating Output")
Else
Application.ScreenUpdating = False
Application.StatusBar = "PLEASE WAIT... " & Worksheets("HomePage").Cells(6,
9).Text
Application.OnTime Now + TimeSerial(0, 0, 5), "ClearStatusBar"
Sheets("Costing").Activate
Range(Cells(1, 1), Cells(71, (c * 3 + 2))).Select
..........
............
End if
End if
End sub


Prem.

"Mike H" wrote:

Hi,

because you don't give too much detail it's hard to be precise but this may
get you going in the right direction.

Private Sub CommandButton1_Click()
response = InputBox("Enter password")
If response < Environ("Username") Then
MsgBox "Incorrect, You must enter you logon username"
Else
MsgBox "Password accepted"

End If
End Sub

Mike

"Premanand Sethuraman" wrote:

Dear All,
I 've made a program in which if the user click a button a userform will
form and it will ask for a Password.
Person should write Password in the textbox in Userform.
I want to accept the password of the Computer name (Log in name).
Will anyone help me how to sort out.

Thanks
Prem.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default How to make Computer name as a Password by VBA

When you say "my computer name" do you mean your logon username or the
Computer Name?

To return Computer Name

MsgBox Environ("computername")


Gord Dibben MS Excel MVP

On Thu, 24 Jul 2008 20:53:01 -0700, Premanand Sethuraman
wrote:

Dear Mike,
Thanks for your reply.
I used the Environ Functrion in my coding as per your suggestions but it is
still saying "Incorrect Password"
My computer name is "env_mktl_prem"
Is it because of "Underscore" sign it is showing "Incorrect Password"?
THis is my coding

Private Sub CommandButton1_Click()
Dim myfile As String
Dim c As Range
Set c = Worksheets("Technical offer").Range("A7")
myfile = ActiveWorkbook.Name
If TextBox1.Text < Environ("Username") Then
UserForm1.Hide
MsgBox ("Incorrect Password")
Else
If c = 0 Then
MsgBox ("Please Enter the data of BagFilter and then use this button for
generating Output")
Else
Application.ScreenUpdating = False
Application.StatusBar = "PLEASE WAIT... " & Worksheets("HomePage").Cells(6,
9).Text
Application.OnTime Now + TimeSerial(0, 0, 5), "ClearStatusBar"
Sheets("Costing").Activate
Range(Cells(1, 1), Cells(71, (c * 3 + 2))).Select
.........
...........
End if
End if
End sub


Prem.

"Mike H" wrote:

Hi,

because you don't give too much detail it's hard to be precise but this may
get you going in the right direction.

Private Sub CommandButton1_Click()
response = InputBox("Enter password")
If response < Environ("Username") Then
MsgBox "Incorrect, You must enter you logon username"
Else
MsgBox "Password accepted"

End If
End Sub

Mike

"Premanand Sethuraman" wrote:

Dear All,
I 've made a program in which if the user click a button a userform will
form and it will ask for a Password.
Person should write Password in the textbox in Userform.
I want to accept the password of the Computer name (Log in name).
Will anyone help me how to sort out.

Thanks
Prem.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default How to make Computer name as a Password by VBA


Lot of Thanks to you Mike.
Yes it is now working perfrectly as per your guidance.
Thank you so much for introducing the function of Environ.

Regards,
Premanand.S

"Gord Dibben" wrote:

When you say "my computer name" do you mean your logon username or the
Computer Name?

To return Computer Name

MsgBox Environ("computername")


Gord Dibben MS Excel MVP

On Thu, 24 Jul 2008 20:53:01 -0700, Premanand Sethuraman
wrote:

Dear Mike,
Thanks for your reply.
I used the Environ Functrion in my coding as per your suggestions but it is
still saying "Incorrect Password"
My computer name is "env_mktl_prem"
Is it because of "Underscore" sign it is showing "Incorrect Password"?
THis is my coding

Private Sub CommandButton1_Click()
Dim myfile As String
Dim c As Range
Set c = Worksheets("Technical offer").Range("A7")
myfile = ActiveWorkbook.Name
If TextBox1.Text < Environ("Username") Then
UserForm1.Hide
MsgBox ("Incorrect Password")
Else
If c = 0 Then
MsgBox ("Please Enter the data of BagFilter and then use this button for
generating Output")
Else
Application.ScreenUpdating = False
Application.StatusBar = "PLEASE WAIT... " & Worksheets("HomePage").Cells(6,
9).Text
Application.OnTime Now + TimeSerial(0, 0, 5), "ClearStatusBar"
Sheets("Costing").Activate
Range(Cells(1, 1), Cells(71, (c * 3 + 2))).Select
.........
...........
End if
End if
End sub


Prem.

"Mike H" wrote:

Hi,

because you don't give too much detail it's hard to be precise but this may
get you going in the right direction.

Private Sub CommandButton1_Click()
response = InputBox("Enter password")
If response < Environ("Username") Then
MsgBox "Incorrect, You must enter you logon username"
Else
MsgBox "Password accepted"

End If
End Sub

Mike

"Premanand Sethuraman" wrote:

Dear All,
I 've made a program in which if the user click a button a userform will
form and it will ask for a Password.
Person should write Password in the textbox in Userform.
I want to accept the password of the Computer name (Log in name).
Will anyone help me how to sort out.

Thanks
Prem.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i use my computer to make a map of my library for student mrs. bookheart Excel Discussion (Misc queries) 2 July 27th 09 07:25 PM
Copy worksheet to another computer when source password prot LindaLov Excel Discussion (Misc queries) 1 January 3rd 07 10:01 PM
Copy worksheet to another computer when source password prot LindaLov Excel Discussion (Misc queries) 0 January 3rd 07 08:34 PM
computer will not recognize password on an Excel workbook? elp Excel Discussion (Misc queries) 1 October 25th 06 02:54 PM
can you make a password active after a certain date? RCollinge Excel Programming 1 June 14th 05 10:51 AM


All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"