Home Forums HTBasic Forum HTBDDE dll

Tagged: 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #9266
    ZeRider
    Participant

      Hi,
      Do you know if there is a limitation of the number of request on an EXCEL worksheet through the HTBDDE dll ?
      When I run this part of my programm I receive the error below after 16238 good data transfert from EXCEL to HTBasic …

      Microsoft Visual C++ Runtime Library
      Runtime Error!
      Programm: C:\Program Files (x86)\HTBwin 10.1\HTBwin.exe
      This application has requested the Runtime to terminate it in an unusualy way.
      Please contact the application’s support team for more information

      LONG Hconvexcel
      DIM C$[20]
      DIM Return$[50]
      DIM Data$(1:200,1:259)[20]
      Row$=”L”
      !
      Total=0
      FOR Line=1 TO 200
      FOR Column=1 TO 259
      C$=””
      C$=Row$&VAL$(Line)&”C”&VAL$(Column)
      Return$=””
      Return$=FNDderequest$(Hconvexcel,C$)
      Total=Total+1
      Data$(Line,Column)=Return$[1,LEN(Return$)-2]
      DISP Total,C$,Data$(Line,Column)
      NEXT Column
      NEXT Line

      #9268
      PatB
      Moderator

        Hi ZeRider,

        I put together a sample program and a sample excel file to try and reproduce the issue you are seeing above. I am able to consistently read all 200 rows of 259 cells. The difference could be in the data being read in since I am not certain the format of your data. Here is a link to the excel file I am using:

        sample.xlsx

        And here is my sample program:

        my sample program:

              CONFIGURE LONGFILENAMES ON
        
              DLL UNLOAD ALL
        
              LONG Hconvexcel! Excel conversation handle
              LONG Retval  ! Return value for the DLL functions
        
              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"
        
            ! Connect to the Excel System topic
              Hconvexcel=FNDdeconnect("Excel","System")
        
              IF Hconvexcel=0 THEN
                 ! If we couldn't connect, lauch Excel and try again
                  Retval=FNRunexe("C:\Program Files\Microsoft Office\root\Office16\Excel.exe",1)
                  WAIT 2
                  Hconvexcel=FNDdeconnect("Excel","System")
        
                 ! If we still couldn't connect, Exit
                  IF Hconvexcel=0 THEN
                      GOTO Exit
                  END IF
              ELSE
                    ! Create a new workbook
                  Retval=FNDdeexecute(Hconvexcel,"[Open(""C:\Program Files (x86)\HTBasic 2021\DLL Toolkit\Samples\HTBDde\sample.xlsx"")]")
        
                  IF NOT Retval THEN
                      PRINT "didn't open"
                      GOTO Exit
                  END IF !
              END IF
        
             IF Hconvexcel=0 THEN
                  GOTO Exit
              END IF
        
              DIM C$[20]
              DIM Return$[50]
              DIM Data$(1:200,1:259)[20]
              Row$="L"
        
              Total=0
              FOR Line=1 TO 200
                  FOR Column=1 TO 259
                      C$=""
                      C$=Row$&VAL$(Line)&"C"&VAL$(Column)
                      Return$=""
                      Return$=FNDderequest$(Hconvexcel,C$)
                      Total=Total+1
                      Data$(Line,Column)=Return$
                      DISP Total,C$,Data$(Line,Column)
                  NEXT Column
              NEXT Line
        
              PRINT "Finished"
        
         Exit:!
        
            ! Terminate the connection with Excel
              IF (Hconvexcel) THEN
                  Retval=FNDdeterminate(Hconvexcel)!Terminate the excel DDE conversation
              END IF
        
            ! Unload the DDE DLL
              DLL UNLOAD "HTBdde"
        
              END
        
        #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 ago by ZeRider.
          #9272
          Ralph Wilson
          Keymaster

            I’m not able to run your sample program because I don’t have a local copy of Excel installed. Mine is the cloud-based Microsoft 365 subscription which doesn’t have a local excel.exe file that can be called. However, as a workaround, I used the sample.xlsx file that Pat provided and did a SAVE AS in CSV format. You can do the same with your data file. I then wrote the below program you can try out that gets the data directly from this file and into the same array, probably faster than going through Excel. However, this assumes there are not embedded commas in your string data.

            Another problem with the Excel interface is you are not getting the HTB error code which could be any number of things. So it’s hard to troubleshoot without knowing the exact line number and error code/message that is causing it to fail.

            Also, since you have been helpful on the forum to others, I could get you a complimentary license key to HTBasic 2021 so you could try that out and see if it makes any difference. If you are interested, send me an email at htbsupport@transera.com.

            Thanks,

            Ralph

            Here’s the program:

            OPTION BASE 1
            DIM Data$(200,259)[20] ! Final array of data
            DIM Lines$(200)[5180] ! 5180 is 259 values times max length of 20 each
            DIM R$[5180] ! temporary comma delimited row string
            DIM Col$(259)[20] ! temporary single row array of extracted column values
            F$=”your folder path to data file”
            ASSIGN @Samples TO F$&”\sample.csv”;FORMAT ON
            ENTER @Samples;Lines$(*) ! get all 200 rows of data
            ASSIGN @Samples TO *

            FOR Row=1 TO 200
            I=1
            R$=Lines$(Row)
            GOSUB Split ! get comma delimited data from R$ into Col$()
            FOR Col=1 TO I ! 259
            Data$(Row,Col)=Col$(Col) ! transfer to Data$
            NEXT Col
            NEXT Row
            PRINT “Total: “;Total
            GOTO Exit

            Split: !extract comma delimited values from string
            P=POS(R$,”,”)
            IF P>0 AND P

            #9274
            Ralph Wilson
            Keymaster

              Looks like some of the code got cut off. Here it is again.

              OPTION BASE 1
              DIM Data$(200,259)[20] ! Final array of data
              DIM Lines$(200)[5180] ! 5180 is 259 values times max length of 20 each
              DIM R$[5180] ! temporary comma delimited row string
              DIM Col$(259)[20] ! temporary single row array of extracted column values
              F$=”your folder path to data file”
              ASSIGN @Samples TO F$&”\sample.csv”;FORMAT ON
              ENTER @Samples;Lines$(*) ! get all 200 rows of data
              ASSIGN @Samples TO *

              FOR Row=1 TO 200
              I=1
              R$=Lines$(Row)
              GOSUB Split ! get comma delimited data from R$ into Col$()
              FOR Col=1 TO I ! 259
              Data$(Row,Col)=Col$(Col) ! transfer to Data$
              NEXT Col
              NEXT Row
              PRINT “Total: “;Total
              GOTO Exit

              Split: !extract comma delimited values from string
              P=POS(R$,”,”)
              IF P>0 AND P

              #9275
              ZeRider
              Participant

                Hi Ralph,
                Thanks a lot for your alternative method. That’s a really good idea that I hadn’t thought of 🙂
                Please find below my new code applied …
                I note your proposal for the HTBasic 2021 test, I will send you an email very soon
                Regards,
                LTK

                PS:
                I confirm it’s not easy to paste HTBasic code in the forum.
                I’m very curious to know how PatB managed to keep his indentation in his message !

                CONFIGURE LONGFILENAMES ON
                DLL UNLOAD ALL
                CLEAR SCREEN
                KEY LABELS OFF
                !
                DIM C$[200]
                DIM Data$(1:200,1:259)[20]
                DIM Disque1$[80],Disque2$[80],Disque3$[80]
                !
                Nb1=259*20 ! Nb of values / Lines
                Nb2=259-1 ! Nb of separator
                Nb3=2 ! Line Terminator [CR]
                Nb=Nb1+Nb2+Nb3
                !
                ALLOCATE Lines$(200)[Nb]
                !
                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 ! Sometime Very long !!! For the moment I prefer to WAIT and [CONTINUE] manually
                ! ! when EXCEL is open, I will work on it with Taskmanager …
                !
                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$)
                WAIT 1
                !
                !——————————————-
                ! PURGE csv File if existing …
                !——————————————-
                Fich$=Fich$[1,POS(Fich$,”.xlsx”)-1]&”.csv”
                Fich$=Disque1$&”\”&Fich$
                !
                ON ERROR GOSUB Err
                PURGE Fich$
                OFF ERROR
                WAIT 1
                !
                !——————————————-
                ! SAVE AS csv
                !——————————————-
                C$=”[Save.As(“””&Fich$&”””,23)]” ! 23 is the file type for csv
                C$=TRIM$(C$)
                !
                Retval=0
                Retval=FNDdeexecute(Hconvexcel,C$)
                WAIT 1
                !
                !——————————————-
                ! CLOSE EXCEL Activ File
                !——————————————-
                Retval=0
                Retval=FNDdeexecute(Hconvexcel,”[File.Close(0)]”)
                WAIT 1
                !
                !——————————————-
                ! READ csv File with HTBasic
                !——————————————-
                ASSIGN @Samples TO Fich$;FORMAT ON
                FOR Row=1 TO 200
                ENTER @Samples;Lines$(Row)
                NEXT Row
                ASSIGN @Samples TO *
                !
                Total=0
                !
                FOR Row=1 TO 200
                !
                GOSUB Split ! get comma delimited data from Lines
                !
                FOR Column=1 TO 259
                Total=Total+1
                PRINT Total,Row,Column,Data$(Row,Column)
                NEXT Column
                !
                NEXT Row
                !
                PRINT “Total =”;Total
                GOTO Exit
                !
                !
                !———————————————
                Err: ! ERROR management
                !———————————————
                ERROR RETURN
                !
                !
                !———————————————
                Split: ! Extract delimited values from string
                !———————————————
                IF POS(Lines$(Row),”,”) THEN C$=”,”
                IF POS(Lines$(Row),”;”) THEN C$=”;”
                !
                J$=””
                Column=1
                FOR I=1 TO LEN(Lines$(Row))
                IF Lines$(Row)[I,I]<>C$ THEN
                J$=J$&Lines$(Row)[I,I]
                ELSE
                Position=I
                Data$(Row,Column)=J$
                J$=””
                Column=Column+1
                END IF
                NEXT I
                Data$(Row,Column)=Lines$(Row)[Position+1,LEN(Lines$(Row))]
                RETURN
                !
                !
                !——————————————–
                ! 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
                KEY LABELS ON
                !
                END

                #9276
                PatB
                Moderator

                  Hi ZeRider,

                  I wanted to see if I could reproduce the failure at line 16379. Using your program in HTBasic 2021 I could not get it to fail. It completed successfully every time. I did see that you were using HTBasic 10.0 and HTBasic 10.1 so I tried those versions and immediately get an error in each and they shutdown which is very odd. If I get the time I will look into it, although since it works fine in our latest release, my recommendation is to use it.

                  Ralphs suggestion is a good one and will be much faster than going through Excel, but if you need to go through Excel for some reason, I would recommend using HTBasic 2021.

                  Concerning how I entered my code in my post, I use the HTML CODE tags provided on the toolbar above and put my code between them.

                  If you do get a copy of HTBasic 2021, I would be interested to know if HTBDDE works successfully for you, or you still hit the same issue.

                  Thanks!

                  #9277
                  ZeRider
                  Participant

                    Hi PatB,
                    my test results with HTBasic 2021 are not better. The program stops and closes without an error message. According to my displays this happens while it tries to read the values on line 64 but the column seems more random…
                    Well anyway, I’m going to use the alternative method recommended by Ralph which works whatever the HTBasic version.
                    I put here my code using EXCEL reading which is defective

                          CONFIGURE LONGFILENAMES ON
                          DLL UNLOAD ALL
                          OPTION BASE 1
                          !
                          CLEAR SCREEN
                          KEY LABELS OFF
                          !
                          DIM C$[200]
                          DIM Return$[50]
                          DIM Data$(1:200,1:259)[20]
                          DIM Disque1$[80],Disque2$[80],Disque3$[80]
                          DIM Htb_version$[80]
                          !
                          LONG Hconvexcel! Excel conversation handle
                          LONG Retval    ! Return value for the DLL functions
                          !
                          !------------------------------------------------
                          ! Computers configuration
                          !------------------------------------------------
                          Htb_version$=SYSTEM$("VERSION:HTB")
                          Htb_version$=TRIM$(Htb_version$)
                          !
                          SELECT Htb_version$
                          !
                          CASE "Windows Release 10.0.3"
                               Disque1$="C:\Program Files (x86)\HTBwin10\DLL Toolkit\Samples\HTBDde"   ! 22/01/2009 13:32 => Runtime Error : L64C32 (16379)
                               Disque2$="C:\Program Files (x86)\Microsoft Office\root\Office16"        ! EXCEL 2010
                               Disque3$="C:\HP_progs\Progs"
                               !
                          CASE "Windows Release 10.1.3"
                               Disque1$="C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde"! 22/01/2009 13:32 => Runtime Error : L64C32
                              !Disque1$="C:\Program Files (x86)\HTBasic 2021\DLL Toolkit\Samples\HTBDde"   ! 14/11/2020 09:44 => Runtime Error : L64C32
                               Disque2$="C:\Program Files (x86)\Microsoft Office\root\Office16"        ! EXCEL 2010
                               Disque3$="C:\HP_progs\Progs"
                               !
                          CASE "Windows Release 21.1.009"
                               Disque1$="C:\Program Files (x86)\HTBasic 2021\DLL Toolkit\Samples\HTBDde"! 14/11/2020 09:44 => HTBasic Close : L64C...
                              !Disque1$="C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde"    ! 22/01/2009 13:32 => HTBasic Close : L64C...
                               Disque2$="C:\Program Files (x86)\Microsoft Office\root\Office16"        ! EXCEL 2010
                               Disque3$="C:\HP_progs\Progs"
                               !
                          END SELECT
                          !
                          PRINT Htb_version$
                          PRINT Disque1$
                          PRINT Disque2$
                          PRINT Disque3$
                          PRINT
                          !
                          !------------------------------------------------
                          ! 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
                          !
                          LIST DLL
                          !
                          !-------------------------------------------
                          ! 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=0
                          Hconvexcel=FNDdeconnect("Excel","Sheet1")
                          !
                          !--------------------------------------------
                          ! Read EXCEL Datas
                          !--------------------------------------------
                          ! => Error after 16379 read (L64C62) ???
                          !--------------------------------------------
                          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
                          !
                          !
                               !--------------------------------------------
                               ! 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
                               PRINT "Finished"
                               KEY LABELS ON
                          !
                          END
                    #9278
                    ZeRider
                    Participant

                      Thanks PatB for your Tips.
                      The code display is beautiful now 🙂

                      #9279
                      Ralph Wilson
                      Keymaster

                        I’m not sure if it will make a difference, but I noticed that you are checking for version 21.1.009 of HTBasic, but the current version is .015. You should download that version to have the latest.

                        #9280
                        ZeRider
                        Participant

                          Hi Ralph,
                          please could share me the link where I can download the latest HTBasic version ?

                          #9281
                          RalphW
                          Participant

                            You can download the latest version of HTBasic from the website by clicking “Downloads” on the menu. Then click “Download Purchases”. Here is the link: https://transera.com/dl-htbasic/

                            #9282
                            ZeRider
                            Participant

                              Hi all,
                              Thanks for the link. I downloaded the last HTBasic version 21.1.015 and the results are indeed differents.
                              With this new HTB version the program don’t stop now before the end but from L64C64 cell, the reading in the EXCEL file are always empty (Return$=””)
                              Very mysterious …

                              #9283
                              precaud
                              Participant

                                This may not be relevant, but on versions prior to 10, there was a 256-byte limit on transfers via the htbdde dll. Has that been fixed? I had to use the Techsoft dde driver to get around it.

                              Viewing 14 posts - 1 through 14 (of 14 total)
                              • You must be logged in to reply to this topic.
                              Scroll to Top
                              HTB icon

                              Please Sign In