web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Protect/Unprotect Excel sheet through X++

(0) ShareShare
ReportReport
Posted on by 160

Hi,

I have scenario where I need to write data into a protected excel sheet, First I need to unprotect the cells for editing through X++ then again protect the sheet with same password. (Password will be hardcoded)

Help much appreciated.

Regards,

AK

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Protect/Unprotect Excel sheet through X++

    The premise is that you have a password to protect Excel. Otherwise, you'll have to try some ways to unprotect Excel sheet, like uploading to Google Sheets, using VBA code, copying and pasting an Excel worksheet. Among them, using VBA code will be more complicated.

  • Pravasti AK Profile Picture
    2,985 on at
    RE: Protect/Unprotect Excel sheet through X++

    Hi Vilmos,

    I am using fim classes for creating spreadsheet and exporting my AX fields into excel.The sheet is protected when i tried to do write operation.

    Error msg :"the cell or chart you are trying to change is on a protected sheet"

    Thanks,

    Kavitha

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Protect/Unprotect Excel sheet through X++

    I have verified this and the SysExcelWorksheet* classes already has the protect method implemented in AX, so all you need to do is implement the unprotect based on the above linked article for the parameters too in order to start using it.

    Please mark the answers with the checkbox next to each post to verify and close the topic.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Protect/Unprotect Excel sheet through X++

    The Worksheet object has the Unprotect method, you could try that. If the COM call is not implemented in AX, you could simply add it yourself in the relevant SysExcel* class.

    [View:https://msdn.microsoft.com/en-us/vba/excel-vba/articles/worksheet-unprotect-method-excel:750:50]

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
howalker Profile Picture

howalker 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans