Home Forums HTBasic Forum HTBDDE dll Reply To: HTBDDE dll

#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

    • This reply was modified 1 month, 2 weeks ago by Ralph Wilson.
    Scroll to Top
    HTB icon

    Please Sign In