Developing secure products are as important as the product itself. Most security measures involve data encryption and passwords. Excel sheets are mostly used for reporting purposes and reports mostly based on confidential data, so security is very important for Excel based reports.
Here, I have tried to develop a small utility for a security implementation. The same code can be used in both Visual Studio 2003 and 2005, and the code can be implemented in C# with proper syntax changes.
Public Filename As String
Public oexcel As Excel.Application
Public obook As Excel.Workbook
Public osheet As Excel.Worksheet
Filename = AppDomain.CurrentDomain.BaseDirectory & _
If File.Exists(Filename) Then
If Not File.Exists(Filename) Then
oexcel = CreateObject("Excel.Application")
oexcel.Application.DisplayAlerts = False
obook = oexcel.Workbooks.Add
oexcel.Visible = True
Console.WriteLine("Generating Auto Report")
osheet = oexcel.Worksheets(1)
osheet.Name = "Test Sheet"
osheet.Range("A1").Value = "Implementing " & _
"Password Security on Excel " & _
"Workbook Using Studio.Net"
osheet.Range("A1").Font.Color = RGB(255, 255, 255)
osheet.Range("A1").Interior.ColorIndex = 5
osheet.Range("A1").Font.Bold = True
Dim password As String = "abc"
obook.Password = password
osheet = Nothing
obook = Nothing
oexcel = Nothing
Catch ex As Exception
Working With the Demo
Download the demo project and unzip it, and then run "Excel_Automation.exe". It will generate an Excel sheet in the same directory with the name "abc.xls". When you try to open the Excel sheet, it will ask to enter the password, enter "abc", then the book will be visible to you.
Working With the Code
Here, I have attached the VB.NET code file, download it and then create a new console application project, and add the file to that project, and try with your desired changes. You can run the same code in both versions of Visual Studio .NET.
This is a small effort to generate a secure report for your critical data. Any feedback/comments are welcomed.
I am working as Manager Enterprise Services where key responsibilities are to support end users on their day to day IT related issues.
The other function I am responsible is IT IPCC Services Support Since September 2013 and my key responsibilities are to maintain IPCC Uptime along with end users support at both CMPak call centers. IPCC enhancements and new feature development is also part of my job role.
The third area that was handed over to me in March 2015 is in-house apps support, where key responsibility is to provide support for all the application developed by IT department and to maintain the availability of these applications.
Previously I was working as Manager Automation & Planning and this is my key area of expertise. My responsibilities were to manage team in Project Planning, System Analysis, Requirements gathering, Preparation of SRS, Presentations to client about the requirements, getting Approvals on SRS from the Client, Database Design, Development Tracking, System Deployments, end user Feedback along with Change Management.
Planning and Defining Scope, Resource Planning, Time Estimating, Creating Charts and Schedules, Risk Analysis
Managing Risks and Issues, Monitoring and Reporting Progress, Team Leadership, Working with Vendors, Scalability were the key area of working along with an efficient problem-solver in professional way with envisions business and technical perspectives to develop workable solutions.
I started my career as developer in 2004 and promoted as team lead IT Automation in 2007 and then as manager so I spend 7 years in Software Development & Project Planning.