Distribute Excel .NET Documents

If you distribute an Excel workbook that uses .NET code to others who don’t have Excel 2003, the .NET code is ignored and programmed features are unavailable. Earlier versions of Excel can open Excel 2003 workbooks, but they can’t run .NET assemblies on start-up.

Note

If you distribute an Excel .NET document to an Excel 2003 user who doesn’t have access to the assembly location, Excel displays an error message when that user opens the workbook.

Choose the policy level to deploy and enter a filename to create

Figure 5-23. Choose the policy level to deploy and enter a filename to create

If you want to distribute a Workbook to Excel 2003 users who don’t have access to the .NET assembly, either distribute and install the assembly with the workbook as described in “Distribute Excel .NET Applications” or clear the _AssemblyName0 and _AssemblyLocation0 custom document properties before sending. For example, the following code saves a copy of the current document without the references to the .NET assembly; then sends the workbook via email:

 Private Sub cmdSend_Click( ) Handles cmdSend.Click Dim _AssemblyName0 As String, _AssemblyLocation0 As String, _ name As String ' Save custom propeperty settings. _AssemblyName0 = _ ThisWorkbook.CustomDocumentProperties("_AssemblyName0").Value _AssemblyLocation0 = _ ThisWorkbook.CustomDocumentProperties("_AssemblyLocation0").Value ' Clear custom property settings. ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.