执行TDL代码时出错

时间:2018-05-31 06:18:41

标签: excel tally

[Collection:ExcelLedgersCollection]
    ODBC: "Driver={Microsoft Excel Driver (*.xls,*.xlsx,*.xlsm,*.xlsb)};DBQ=C:\Desktop\List.xls"
    SQL: "Select * from [Items$]"

[Function: ImportFromExcel]
    Variable    :TotalEntries   :Number
    Variable    :Count          :Number
    00: Set     :TotalEntries   :$$NumItems:ExcelLedgersCollection
    10: Start Progress: ##TotalEntries :"Items Creation" : "Importing Items in" : ##SVCurrentCompany
    20:     Walk Collection: ExcelLedgersCollection
    30:         New Object      :Ledger
    40:             Set Value   :Barcode    :$_1
    50:             Set Value   :Name       :$_2
    60:             Set Value   :Quantity   :$_3
    70:         Create Target
    80:         Show Progres    : ##Count 
    90:         Increment       :  Count 
    100:    End Walk
    110: End Progress
    120: Msg Box    : "Status" : "Ledgers from Excel Imported Successfully"


[#Menu: Gateway of Tally]
    Add: Item: Before:@@locQuit: "Import From Excel" :Call :ImportFromExcel

我运行上面的代码,我收到以下两个错误:

  

1功能' ImportFromExcel' LABEL:10无效的步骤数2   功能' ImportFromExcel' LABEL:10动作执行失败!

该函数基本上尝试从名为List.xls的excel文件中读取数据。我搜索了这两个错误,并找到了一些建议:

  1. OS + Tally + Microsoft Office应该都是32位或64位。
  2. excel文件扩展名应为xls而不是xlsx。
  3. 我有一个64位系统,我已经检查过以确保Office和Tally都是64位。另外,我的文件扩展名是.xls。关于为什么这可能不起作用的任何其他想法?

1 个答案:

答案 0 :(得分:0)

在第00行上设置Totalentries(将行号修改为001可能更安全)之后,尝试通过发出命令002来打印Totalentries:log:## Totalentries。在我看来,您的ExcelLedgersCollection集合中没有任何值。