Showing posts with label Password VBA. Show all posts
Showing posts with label Password VBA. Show all posts

Wednesday, June 4, 2008

Convert number into Indian National Rupees word!

MS Excel is a banker’s delight software; they have every function and formula to carryout day to day task. But if you are in India and you are required to process a check copy with INR in words, the only way of doing it is typing it yourself.

There are articles about creating a UDF to do this using VBA but unfortunately most of them are about USD number system. Below is Excel Add-in that will provide you a function called =ConvertCurrencyToINR() to convert any number in INR words.


Download and Save the .xla file from link, then use Tool-> Add-in in Excel to install the add-in





Formula Syntax;

=ConvertCurrencyToINR(myNumber As Number, check_negetrive as Boolean)

ConvertCurrencyToINR() checks if the number is negative (only if you check_negetrive as True or 1) and then convert the number is INR words and Prefix Negative if it’s a negative value. You can disable the check_negetrive option by provide 0 or False input in formula.


How to use

In Cell A1 enter -15896.36

In cell A2, inter the formula =ConvertCurrencyToINR(A1,1)
In Cell B2 inter the Fomula =ConvertCurrencyToINR(A1, 0)

Excel-add in for "Collecting Data from Multiple Excel Workbooks into a Single Text File using VBA"

This is a Excel Add-in created with cods I had discussed in "Collecting Data from Multiple Excel Workbooks into a Single Text File using VBScript"

Monday, May 26, 2008

Prompting for a password before running a VBA code

The macro below will help you set a custom password for running a macro in workbook. Let’s say you have a run query button on your worksheet and you want to make sure before running the codes behind this query user needs to be authenticated.


Private Sub CommandButton1_Click()

Dim strPass As String ' This sting is password

Dim lCount As Long

For lCount = 1 To 3

strPass = InputBox(Prompt:="Password Please", Title:="PASSWORD REQUIRED")

If strPass = vbNullString Then 'Cancelled

sLast.Select

Exit Sub

ElseIf strPass <> "Password" Then 'InCorrect password

MsgBox "Password incorrect", vbCritical, "Failed"

Else 'Correct Password

Exit For

End If


Next lCount

If lCount = 4 Then 'They use up their 3 attempts

MsgBox "The password is wrong, workbook is going close", vbInformation

ActiveWorkbook.Close SaveChanges:=False

Exit Sub

Else

MsgBox "Correct Password", vbOKOnly 'put your codes from hear on

End If

End Sub