Quote Originally Posted by Focus View Post
spent a couple of hours trying to convert it to Excel16. nightmare. I suspect the changes to the object model confuse things but I swear MS have renamed stuff for fun.

Then I took your oXL objects out of the class and it worked.

Now to try opening 10 spreadsheets at once

oh, to update your example, should you need it...
Code:
Use Excel16.pkg


        Object oXlApplication is a cComApplication
        End_Object
        
        Object oXLWorkbooks is a cComWorkbooks
        End_Object




        Object oXLWorkbook is a cComWorkbook
        End_Object
        
        Object oXLWorksheet is a cComWorksheet
        End_Object
        
        Object oXLRange is a cComRange
        End_Object


Deferred_View Activate_Util for ;
Object Util is a dbView
    Use ActLikeSDI.pkg    


    Set Border_Style to Border_Thick
	  Set Size to 200 450
    Set Location to 2 2
    Set Maximize_Icon to True
    Set Icon to "kirknet.ico"
    Set Label to "Util"


    Set Verify_Data_Loss_Msg to 0
    Set Verify_Exit_Msg      to 0




    Object oTest is a Button
        Set Size to 12 115
        Set Location to 65 91
        Set Label to 'test excel via COM'


        Procedure OnClick
        Boolean bCreated
        Variant v
        
        //Get IsComObjectCreated of oXlApplication to bCreated
        //If (not(bCreated)) Begin 
        Send CreateComObject of oXlApplication
        //End
        
        Get ComWorkbooks of oXlApplication to v
        If (IsComObject(v)) Begin 
            Set pvComObject of oXLWorkbooks to v
            Get ComAdd of oXLWorkbooks Nothing to v
            If (IsComObject(v)) Begin 
                Set pvComObject of oXLWorkbook to v
                Get ComActiveSheet of oXLWorkbook to v
                If (IsComObject(v)) Begin 
                    Set pvComObject of oXLWorksheet to v
                    Get ComRange of oXLWorksheet "A1" "A1" to v
                    If (IsComObject(v)) Begin 
                        Set pvComObject of oXLRange to v
                        Set ComValue of oXLRange OLExlRangeValueDefault to 24
                        Set ComVisible of oXlApplication to True
                    End
                End                    
            End                 
        End
            
        End_Procedure


    End_Object