Results 1 to 2 of 2

programatically password protect the excel sheet from the disk

Threaded View

anshuman.mohanty programatically password... 10-23-2009, 10:29 AM
Leith Ross Re: programatically password... 10-23-2009, 01:52 PM
  1. #1
    Registered User
    Join Date
    10-23-2009
    Location
    orissa
    MS-Off Ver
    Excel 2003
    Posts
    1

    programatically password protect the excel sheet from the disk

    I have an existing Excel file. I need to programatically password protect the file so that it can't be read unless the user provide the password.

    I donot want to use INTEROP object like this
    Dim gXL As Excel.Application, gWB As Excel._Workbook, gSheet As Excel._Worksheet ', gRng As Excel.Range ', debug As Boolean = False
        Const password As String = "Det gætter I aldrig!"
    
                gXL = New Excel.Application()
                Dim templateNAME As String = Server.MapPath(IIf(read_only, "template_readonly.xls", "template.xls"))
                gWB = gXL.Workbooks.Open(templateNAME)
                gSheet = gWB.ActiveSheet
    
                Dim rest As String = bog(gnames_width) + CStr(gMins.Count + nbr_of_headlines)
               gWB.Sheets(2).activate()
                gSheet = gWB.ActiveSheet
                gSheet.Range("A3", rest).Value2 = gnames
     If password <> "" Then gSheet.Protect(password, AllowSorting:=True, AllowFiltering:=True, AllowFormattingColumns:=True).
    Please i donot want to use Excel.Application object or interop object.

    Suppose my excel sheet is present at C:\temp\cost.xls.

    I am generated the excel sheet using XSLT/XML .

    Please provide any other way to protect my excel sheet.

    Many Thanks.
    Last edited by Leith Ross; 10-23-2009 at 01:41 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1