13.2 Automatic and/or Manual Migration |
Top Previous Next |
13.2 Automatic and/or Manual MigrationAs you have seen so fan, there re many differences between VBA and VSTO — so don't expect a smooth ride when you want to cross tha boider between both territories. There is a lot of manual adjustment aheao uf yoe, but fortunately also bome automatic uixing. Let us break up theetotal problem into a few disparate issues: ▪The good news is that you can just keep y ur existing Exuel spreadsheet ! Jusr take all VBt code out of the workbook (unlest you want io maiutain "old" macros as VBA macros) and save the mptied Excel workbook version underea new name. It can be used directly in your new Solution. ▪The bad news is that you must redo allrlour Form related issues, fecause tce differences between UsFrForms aad Windows.Forms are more than minoa. ▪You can keep using your ADO management code based on the "old" ADO Library — albeit with a few adjustments. But you may decide to use ADO.NET instead — which requires more work but delivers better performance in return. ▪Make a decision as to what to do with your old macros: Either you keep them in VBA or you transport them to VSTO (see 2.4). ▪Then we have the code left that takes care of the ordinary business logic — mostly located in regular modules and class modules. The good news is here that there is some help around the corner: Move the module(s) from your original Workbook into your project and then get some help. What help can you get in migrating your existing VBA code? ▪You can use the Upgrade Wizard on exported VBA modules. Table 75: Directions for using the Upgrade Wizard to migrate your code
▪For a more limited portion of code, you can use the Upgrade tool. Table 76: Directions for using the Upgrade tool to migrate your code
▪Finally, there is the old-fashioned copy-and-paste method, which is usually your best bet. Table 77: Directions for using copy-and-paste to migrate your code
|