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 |
|
Andrei Smolin
Add-in Express team
Posts: 19138
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?
Andrei Smolin
Add-in Express Team Leader |
|
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 |
|
Andrei Smolin
Add-in Express team
Posts: 19138
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.
Andrei Smolin
Add-in Express Team Leader |
|
MarcumLLP
Posts: 31
Joined: 2015-02-10
|
Worked perfect, thank you! |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Welcome!
Andrei Smolin
Add-in Express Team Leader |
|