none
excel automation office 2013 over document error RRS feed

  • Question

  • I have a Ole Control with Excel file open from vb6 embbeded. 
    This program was Sucessfully used excel version 2003~ 2010.
    But I have a problem from the Excel 2010 later version.
    It was used There is a problem with code

    type1

    Set excel = New Excel.Application
    Set excelbook = oExcel.Workbooks.Open("C:\temp\test1.xlsx")

    the following code,it is very well but for the code below there is a problem that each of the control of Excel
    type2

    Set excelbook = GetObject("C:\temp\test1.xlsx", "Excel.Sheet")

    In excel 2013, type 1 and type2 what difference?
    What other comparative method(type1,type2) applied to find the differences excel instance?

    Note that The same problem in c#,vc++ excel instance


    Wednesday, October 12, 2016 9:04 PM

All replies

  • >>>In excel 2013, type 1 and type2 what difference?

    According to your description, type1 is to start a new instance of Microsoft Excel.

    As type2, if an instance of Microsoft Excel is running when this code is executed, you have access to the running instance's object model through the excelbook variable. If no instance is running, you receive the following trappable run-time error message:

    Run-time error '429':
    ActiveX component can't create object

    For more information, please refer to GetObject and CreateObject behavior of Office automation servers

    Thanks for your understanding.

    • Proposed as answer by David_JunFeng Thursday, October 20, 2016 1:25 AM
    Thursday, October 13, 2016 1:24 AM