Senin, 29 September 2008

Making Password when Printing in Microsoft Word

Printing is a simple activity in Microsoft Word. Everyone can do it. We alcoways do it, File => Print or we enter keyboard together with Ctrl+P. We can look the dialog print like the picture.

The problem, Can we print document with security? Like a password when we print document?

Microsoft word can't do it. There aren't tools to do it. So we must configure it with Visual Basic Editor (VBE). It is a adding tools in Microsoft Word with Basic Language. If we are familiar with Basic, so we will be easy to create in VBE Microsoft Word.

In this article, we will make a program (source code), when we click File Print (Ctrl + P) the dialog like it :
So when we input the password true (password ='Sutrisno'), like :
whe the password is wrong (example we write 'zdx'), the dialogs will like :
The ask is how make it. It is very easy to do. You click Tools => Macro => Visual Basic Editor or enter keyboard together (ALT+F10) so will dialog visual basic editor. After that step is done, then right click project normal. So copy or write this coding in t
the project.

'-------------------------------------

Sub FilePrint()

Dim txtPass

Dim txtMasuk

txtMasuk = "Sutrisno"

txtPass = InputBox("Input the Password", "Security Options")

If txtPass = "" Then Exit Sub

If txtPass = txtMasuk Then

Dialogs(wdDialogFilePrint).Show

Else

MsgBox "Wrong Password", vbCritical, "Confirmation !!!"

End If

End Sub

-------------------------------------


After copying or writing the source code above, we will look the dialogs like the picture behind. And don't forget, click File =>Save to save this session. This article is too publishing in Indonesian Edition. Thanks.. And Good Luck




























 
Indonesian Edition