locked
VB6 Excel Automation Vs VS 2010 Excel Automation RRS feed

  • Question

  • Hi,

    We have legacy VB6 application which produces excel reports through VBA automation, this legacy application was replaced by VS 2010 which uses Office tools for automation. We have observed that macros are running on old reports without any issue but they fail to run on VS2010 generated reports.Is there any difference in VBA automation and VS2010 office automation. For VS2010 office automation we are using Office 14.0.0.0.Many thanks.

    Regards,

    Win_coder


    SM

    Monday, March 19, 2012 10:17 AM

Answers

  • In VB6 I use to use the Excel.Exe library which ran the same as VBA code inside a workbook.  Using Visual Studio now requires using the Interop Excel Library Interop.Excel.dll which runs much slower than VB6.   Office 14.0.0.0 is Office 2008 which will only support 32 bit environment so you have to make sure you are compiling VS2010 in 32 bit mode and not 64 bit mode.  To ensure this happens you should use int32 instead of just int and any other variable declarations.  The Office 14.0 library variable declaration will specify Int (which will be 32 bit) while VS2010 will declar variables Int (which will be 64).

    You also have to make sure you are not using any Excel 2010 new features that weren't supported in excel 2008.  The Office library 14 will only allow you to use 2008 features.


    jdweng

    • Proposed as answer by Dummy yoyo Tuesday, March 20, 2012 8:16 AM
    • Marked as answer by win_coder Tuesday, March 20, 2012 9:39 AM
    Monday, March 19, 2012 10:55 AM