Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6529445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:38:10+00:00 2026-05-25T09:38:10+00:00

I am using the Microsoft.Office.Interop.Excel library in VB.Net on an excel sheet that is

  • 0

I am using the Microsoft.Office.Interop.Excel library in VB.Net on an excel sheet that is protected. All of the protected settings are working fine except that I cannot set Select Locked Cells which shows when you are using the Excel protect sheet interface but I cannot see how to set this to false using the library. I have tried all of the different values in the protect method but none of them toggle the value.

Excel protected sheet menu
Excel protected sheet menu

Below is the code snippet I am using to get my workSheet, populate some values, and then protect the sheet. GetWorkSheet is an internal method which will return a WorkSheet object, and invoiceData is a datatable which has the data which is being added to the spreadsheet.

Dim newSheet As Worksheet = getWorkSheet(newSheetName)

' Make the current Work Sheet active so that it will be accepting the data.
newSheet.Activate()
newSheet.Unprotect(sheetPassword)
For i As Integer = 1 To invoiceData.Rows(0).ItemArray.Count
    newSheet.Cells(transactionalRow, i) = invoiceData.Rows(0).ItemArray(i - 1)
Next
'work is done so protect it again
newSheet.Protect(sheetPassword, False, True, False, True, True, True, True, True, True, True, True, True, True, True, True)
excel.ActiveWorkbook.Save()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:38:11+00:00Added an answer on May 25, 2026 at 9:38 am

    It’s very confusing because that property is not set with the Protect statement.

    After calling your protect statement, issue the following call:

    ActiveSheet.EnableSelection = xlNoRestrictions
    

    See this page for the other values for EnableSelection:
    http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.enableselection(VS.80).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Issue: I am using the Microsoft.Office.Interop.Excel library in an ASP.NET application, and I have
i have a web service that reads data from excel using Microsoft.Office.Interop.Excel. It works
I am using Microsoft.Office.Interop.Excel to read a spreadsheet that is open in memory. gXlWs
I am creating an Excel Worksheet from C# using Microsoft.Office.Interop.Excel, and I have not
I am using Microsoft.Office.Interop.Excel.Application oExcelApp = (Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject(Excel.Application); in my project. It gives me an
I'm opening an excel worksheet using the Microsoft.Office.Interop.Excel COM interface. I'm trying to adjust
I am using Microsoft Office Interop to open Excel files. The file is placed
I am using this in Script Component In SSIS --> Microsoft.Office.Interop.Excel.Application objXL = new
I have the following code: [Thank you Mike Rosenblum!] using System; using Microsoft.Office.Interop.Excel; using
I using Microsoft.Office.Interop.Excel I get returned a 2D array of type object[,] which contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.