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

Notifications

Announcements

No record found.

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)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    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]

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    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.

  • Pravasti AK Profile Picture
    2,985 on at

    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

  • Community Member Profile Picture
    on at

    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.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans