Background: A year ago, a project needs to use Excel for data entry, considering that many users or Xp+office 2003, so the development of the time directly using the Excel 2003 version of VBA development. Perhaps a lot of people will say, Win10 all out, Microsoft Office is free, also use Office2003??? But the customer is God!
Probably the development process: the user directly open an Excel file, Excel file prompts the user to log in, after landing, see To do tasks, choose to do tasks, open the corresponding Excel form template for data entry, save the submission. Above, VBA in Excel will interact with service services in the server (nonsense).
The problem comes, because VBA is directly embedded in the Excel file, only one project, maintenance update is not very troublesome, but when other projects also want to use this Excel program, headache, can not each project a set of VBA code bar ...
Why isn't VSTO (Visual Studio Tools for Office)?
The audience for VSTO is "professional developer", which can be understood as making money from it, and if it is more appropriate to deal with the problem of daily work in VBA. OK, we are also "professional developers", then try to test VSTO.
Believe that a lot of people are like me, the development machine is loaded with win7+, vs2012+, office2010+.
1, VS2012 and Office2010 environment
Without hesitation, I first tried to develop Excel2003 VSTO directly under VS2012 and Office2010. New-office-excel2010 Workbook-OK, you can see the 97-2003 option in the wizard page, drop-down options. After selecting the 03 format, there is no problem with the build or F5.
Next, make a simple installation package. In the development machine installation, run successfully! The key is to get the installation package to the virtual machine (XP, office2003), the runtime prompt failed to load the common language runtime, the relevant NET Framework is already installed! P.S: If you do not deploy with the installation package, directly copy the files from the VS Bin directory to the virtual machine, you will be prompted not to find the addin element.
It's been a while since this problem has been tangled up, and finally realized that the version above VS2010 is not already supported for Office 2003 VSTO.
2, VS2005 and Office2003 environment
Re-opened a virtual machine, and then downloaded from the Internet a VS2005 Chinese version (although said "outdated", but there are a lot of downloads on the Internet). Then download the full version of Office2003. See the garden This article says vs and Office installation sequencing, I still deliberately installed Office first.
The SP1 of the VS2005 was also played.
Take a look at VS2005 's nostalgic interface.
In VS2005, when you create a new Office project, the default is only a few options, as shown in.
Build, Debug something, everything is still normal. Then prepare for deployment. Well, that's right, post a link to the classic two MSDN articles.
Deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer (Part 1 of 2)
Deploying Visual Studio 2005 Tools for Office Solutions Using Windows installer:walkthroughs (Part 2 of 2)
At first glance, it really is "lengthy", an eyeful of e-text, see the head is a bit painful, yimushihang to look at, and then hands-on new vs Setup Project.
When you add prerequisites (prerequisites), Office Runtime and Office tools are not in the Discovery list. Well, again Baidu (basically did not find useful), Google, also put office reload, vs repair, those things are still hide-and-seek.
When there's no way out, look back deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer (Part 1 of 2). Patiently looked down, suddenly found: "
Adding the Visual Studio 2005 Tools for Office Packages to the Bootstrapper
The following instructions describe how to add the packages listed above to the bootstrapper package directory. These changes need only is made once and only on the development computer.
For this task, you must has the files that is available in the Windows Installer that accompanies this article. You must prepare the files before your copy them into the bootstrapper package directory.
Preparing The Office application and Office Primary Interop assemblies Checks
You must compile the Office application and primary interop assembly Checker program samples.
......”
Dizzy, not all of the tutorial stickers have a picture of the truth. How to add an Office package to the Setup Launcher I ignored the steps! The following instructions for the original text are simply translated in your own words.
① installing the. NET Framework 2.0 Software Development Kit (SDK) and the Windows Platform SDK (online installation link)
These defaults are not installed with vstor, you need to go to the Microsoft Download Center to download the installation. The latter has a long online installation time and needs to be waited patiently. It is recommended to download the hard disk version directly and install it locally.
These are not required if you are using Microsoft Visual Studio Team System.
② Compiling the Check program
There is a collection installation package that provides a code sample and deployment tool that needs to be downloaded and installed, and then
C:\Program Files\Microsoft Visual Studio 2005 Tools for Office resources\vsto2005 Windows Installer Sample
You can see the associated file, referred to as {SamplesDir}.
Open the VS2005 command prompt, CD to the {samplesdir}\projects\checks directory.
Enter the following command successively:
" C:\Program Files\Microsoft Platform Sdk\include " /oxs/mt/gs AppCheck.cpp
You can now see a few more files under the directory
" C:\Program Files\Microsoft Platform Sdk\include " " C:\Program Files\Microsoft Platform Sdk\lib\advapi32.lib "
The Windows Platform SDKwill prompt you to open the input file. Then copy the generated PIACheck.exe to {Samplesdir}\packages\office2003pia.
③ Preparation Office 2003 primary Interop assemblies ( Interactive assemblies)
Download and unzip the Office 2003 update:redistributable Primary Interop assemblies, then copy the extracted O2003pia.msi to {samplesdir}\packages\ Office2003pia folder.
④ Preparing Visual Studio 2005 Tools for Office Runtime (runtime)
Download, copy the VSTOR.exe to the {Samplesdir}\packages\vstoruntime folder
⑤ preparing visual Studio Tools for Office Language Pack (language Pack)
Download, copy the Vstolp20.exe to the {Samplesdir}\packages\vstolp folder
⑥ Copy the package information directory to the boot loader directory
That's what the original says.
In Visual Studio 2005 Tools for Office, the default directory is Here:c:\program files\microsoft.net\sdk\v2.0\bootstrapper \packagesin Visual Studio Team System, the default directory is Here:c:\program Files\Microsoft Visual Studio 8\sdk\v2.0\b Ootstrapper\packages
My VS2005 SE, Windows Server 2003, couldn't find the first path, so I had to copy it to the second directory.
C:\Program Files\Microsoft Visual Studio 8\sdk\v2.0\bootstrapper\packages
To this, is to sue a basic paragraph, re-open VS2005, you can see in the system must, that several east is finally run out!
Try the development, deployment of Office 2003 VSTO