Set AllowFormattingCells when protecting the worksheet.

Add-in Express™ Support Service
That's what is more important than anything else

Set AllowFormattingCells when protecting the worksheet.
 
MarcumLLP




Posts: 31
Joined: 2015-02-10
I am using the Protect() from Excel.Worksheet but it only provides 5 parameters. Unlike the VSTSO version of the Protect() I can set true or false for AllowFormattingCells when protecting the sheet. How can I do this using AddIn Express?

Thanks,
Tom
Posted 12 Jan, 2017 10:02:05 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Hello Tom,

The only Excel version providing 5 parameters in the Worksheet.Protect() method is Excel 2000. I assume that you use version-neutral interops, correct? If so, do you really need to support Excel 2000?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Jan, 2017 10:09:41 Top
MarcumLLP




Posts: 31
Joined: 2015-02-10
No I dont, only Excel 2013 and up. Maybe I am referencing the wrong dll version. I am referencing Interop.Excel.dll Version 1.3. Which one should I reference?

Or better yet, how can I update the AddiIn Express project to Office 2013?

Thanks
Posted 12 Jan, 2017 10:13:37 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
MarcumLLP writes:
Interop.Excel.dll


That's it! It is a version-neutral interop = an interop for Excel 2000

You can switch to using interops for Office 2013+:
- delete references related to Office 2000: Interop.Office.dll, Interop.Excel.dll, and Interop.VBIDE.dll
- in Windows Explorer, navigate to {Add-in Express}\Redistributables\Interop Assemblies\Office 2013, copy Office.dll and Microsoft.Office.Interop.Outlook.dll to {your project folder}\Interops; optionally, if you only use the corresponding functionality, also copy Microsoft.Vbe.Interop.dll to the same folder
- In the Visual Studio IDE, reference the assemblies copied on the previous step
- in the IDE, open adxloader.dll.manifest (see the Loader folder in your project) and add the following attribute to the loaderSettings tag: minOfficeVersionSupported="15"
- rebuild your project, modify the code; typically, changes are of this type: someCollection.Item(index) --> someCollection[index]
- done.

Actually, you can just create a new project targeting Excel 2013 to find out the referenced interops and loader settings mentioned above.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Jan, 2017 10:39:14 Top
MarcumLLP




Posts: 31
Joined: 2015-02-10
Worked perfect, thank you!
Posted 12 Jan, 2017 10:45:52 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Jan, 2017 11:02:45 Top