Home Forums HTBasic Forum HTBDDE dll Reply To: HTBDDE dll

#9269
ZeRider
Participant

    Hi PatB,
    Thanks for help and test.
    I made some modifications in my code according to yours (please find below my complete updated code)
    Unfortunatly after a lot of tests on different computers, 2 different EXCEL version, 2 different HTBDDE.dll version, different EXCEL files (including one completely blank EXCEL file) I always have the same error.
    My maximum number of read is 16379 (L64C62) …!!!
    Please could re-test my last code on your computer and verify on your side ?
    Thanks again
    Regards,
    ZeRider

    CONFIGURE LONGFILENAMES ON
    !
    DLL UNLOAD ALL
    !
    DIM C$[200]
    DIM Return$[50]
    DIM Disque1$[80],Disque2$[80],Disque3$[80]
    DIM Data$(1:200,1:259)[20]
    !
    LONG Hconvexcel! Excel conversation handle
    LONG Retval ! Return value for the DLL functions
    !
    Pc=1 ! Computer choice
    !
    !————————————————
    ! Computers configuration
    !————————————————
    SELECT Pc
    CASE 1 ! HTBasic 10.1
    Disque1$=”C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde”! 22/01/2009 13:32
    !Disque1$=”C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde”! 14/11/2020 08:44
    Disque2$=”C:\Program Files (x86)\Microsoft Office\root\Office16″ ! EXCEL 2010
    Disque3$=”C:\HP_progs\Progs”
    CASE 2 ! HTBasic 10.0
    Disque1$=”C:\Program Files (x86)\HTBwin10\DLL Toolkit\Samples\HTBDde” ! 22/01/2009 13:32
    Disque2$=”C:\Program Files (x86)\Microsoft Office\Office14″ ! EXCEL 2010
    Disque3$=”C:\HP_progs\Progs”
    END SELECT
    !
    !————————————————
    ! HTBDDE dll
    !————————————————
    MASS STORAGE IS Disque1$ ! Go to DDE Directory
    !
    DLL LOAD “HTBDDE”
    DLL GET “LONG HTBDDE:Ddeconnect”
    DLL GET “SHORT HTBDDE:Ddeterminate”
    DLL GET “LONG HTBDDE:Ddetimeout”
    DLL GET “SHORT HTBDDE:Ddeexecute”
    DLL GET “SHORT HTBDDE:Ddepoke”
    DLL GET “CHARPTR HTBDDE:Dderequest”
    DLL GET “SHORT HTBDDE:Runexe”
    !
    MASS STORAGE IS Disque3$ ! Return to my Directory
    !
    !——————————————-
    ! Connect to the EXCEL System topic
    !——————————————-
    Hconvexcel=0
    Hconvexcel=FNDdeconnect(“Excel”,”System”)
    !
    IF Hconvexcel=0 THEN
    !
    ! If we couldn’t connect, lauch EXCEL and try again
    !
    C$=Disque2$&”\Excel.exe”
    C$=TRIM$(C$)
    !
    Retval=0
    Retval=FNRunexe(C$,1)
    !
    PAUSE ! Very long !!! I prefer to WAIT and [CONTINUE] manually
    ! ! when EXCEL is open
    !
    Hconvexcel=0
    WHILE Hconvexcel=0
    Hconvexcel=FNDdeconnect(“Excel”,”System”)
    WAIT .1
    END WHILE
    !
    ELSE
    !
    GOTO Exit
    !
    END IF
    !
    !——————————————-
    ! OPEN selected workbook in DDE Directory
    !——————————————-
    Fich$=”sample.xlsx”
    !
    C$=Disque1$&”\”&Fich$
    C$=”[OPEN(“””&C$&”””)]”
    C$=TRIM$(C$)
    !
    Retval=0
    Retval=FNDdeexecute(Hconvexcel,C$)
    !
    !——————————————–
    ! Connexion on the selected Sheet
    !——————————————–
    Hconvexcel=FNDdeconnect(“Excel”,”Sheet1″)
    !
    !——————————————–
    ! Read EXCEL Datas
    !——————————————–
    Row$=”L”
    Line_max=200
    Column_max=259
    !
    Total=0
    FOR Line=1 TO Line_max
    FOR Column=1 TO Column_max
    !
    C$=””
    C$=Row$&VAL$(Line)&”C”&VAL$(Column)
    C$=TRIM$(C$)
    Return$=””
    Return$=FNDderequest$(Hconvexcel,C$)
    !
    Total=Total+1
    Data$(Line,Column)=Return$
    PRINT Total,C$,Data$(Line,Column)
    !
    !C$=”[SELECT(“””&C$&”””)]”
    !C$=TRIM$(C$)
    !Retval=0
    !Retval=FNDdeexecute(Hconvexcel,C$)
    !
    NEXT Column
    NEXT Line
    !
    PRINT “Finished”
    !
    !——————————————–
    ! Terminate the connection with EXCEL
    !——————————————–
    Exit: IF Hconvexcel=1 THEN
    Retval=0
    Retval=FNDdeterminate(Hconvexcel)! Terminate EXCEL DDE conversation
    END IF
    !
    DLL UNLOAD “HTBDDE” ! Unload DDE dll
    !
    END

    • This reply was modified 11 months, 1 week ago by ZeRider.
    Scroll to Top
    HTB icon

    Please Sign In