Jump to content

Recommended Posts

Posted

Hello,

I am trying to copy data from excel and then paste that data into an Autoit listview. For example, please refer to uploaded images.

As an alternative, I tried using ObjCreate("OWC10.spreadsheet") -- check Autoit code -- to create a grid inside my program directly. The problem with that is that if I use this grid within a tab object( which is what I need to do), it starts behaving weird (i.e. the grid disappears when we type data into the cells, the object randomly changes location).

So if anyone has a solution to the Excel grid problem, that would be awesome.

Thanks in advance,

#include <GUIConstants.au3>
    
    Local $oExcel1
    ;Declare objects
    $oExcel1 = ObjCreate("OWC10.spreadsheet"); Default to Office XP

    If not IsObj($oExcel1) Then
        $oExcel1 = ObjCreate("OWC11.spreadsheet"); Office 2003    
    EndIf
    If not IsObj($oExcel1) Then
        $oExcel1 = ObjCreate("OWC00.spreadsheet"); Office 2000
    EndIf
    
    If IsObj($oExcel1) Then
        With $oExcel1
            .Worksheets("Sheet1").Protect 
            .Worksheets("Sheet1").Cells.Range("A:B").Locked = False
        EndWith
    Else
       MsgBox(0,"Reply","Not an Object",4)
   EndIf
   
$mainform_form = GUICreate("Claret Trading Platform v.1.00 - ", 1107, 661, 116, 151, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS))  
    $main_tab = GUICtrlCreateTab(168, 8, 937, 649)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $allocation_bulk_sheet = GUICtrlCreateTabItem("Allocation:Bulk")
    

    $allocation_bulk_reguacc_excel = GUICtrlCreateObj($oExcel1, 305, 200, 220, 420)
    GUICtrlSetStyle($allocation_bulk_reguacc_excel, $WS_VISIBLE)
    GUICtrlSetResizing ($allocation_bulk_reguacc_excel, $GUI_DOCKAUTO)
    
    GUISetState(@SW_SHOW)
    
    While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
Exit

post-24843-1193254024_thumb.jpg

post-24843-1193254228_thumb.jpg

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...