简体   繁体   中英

Visual Studio 2017 VB.Net Office 2010 Compatibility Issues

I created a program in Visual Studio 2017 using VB.net, which takes form data and creates a Word document with an Excel graph. I am running Win 10 and Office 2016. I have successfully run the program on Windows 7 - 10 (32 or 64) on both Office 2013 and Office 2016. However, I need the program to run on a Win 10, Office 2010 machine. Any version of Windows with Office 2010 simply says the program/app has stopped running.

Per what I have found on this site and other sites, it appears that such a program can run on Office 2010 with a certain .NET version and Visual Studio 2010 Tools for Office Runtime installed. Here is the link: https://msdn.microsoft.com/en-us/library/bb772080.aspx

I have tried installing these on multiple systems, but it seems to make no difference in the result. I used the Event Viewer to see what was going on, and it looked like there was some security setting preventing the program from operating with Word and Excel, but when I changed the security settings in those two programs per advice received elsewhere, I still got the same result.

My searching leads me to believe there is a solution, and a simple one at that, but it has eluded me. Thanks in advance for advice.

My code worked fine on computers with Office 2013 or 2016, but some changes made from 2010 to 2013 lead some of my code to be invalid when trying to operate on computers running Office 2010. The Word code was fine, but the Excel code had three issues. Here is what they were and how I fixed them:

  1. Office 2010 and before do not allow Excel data label width modifications, so I compensated by increasing the overall width of the chart.

  2. The method FullSeriesCollection for my Excel Series was not valid for Office 2010, so I used the method SeriesCollection instead.

  3. I had to put my variable for the Excel chart range above my variable for the Excel chart. I'm not sure exactly why this was needed, because it worked fine in Office 2013 & 2016.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM