I need help with javascript code for the following:
I created an order form .pdf. The first field on the form is the order number.
I would like to automatically generate an order number every time a .pdf file is opened. In addition, I want it to increase by 1, starting with number 1001 every time the order form opens.
I saved the numeric value 1001 in cell (1,1) of the excel file.
I want to create javascript to extract (read) the current value in cell (1,1) and return this data to me.
In addition, I want the same script to overwrite the current value in cell (1,1) with a value of + 1.
I searched the Internet many times and found a few bits of code, but none of them gave the results that I want. maybe I'm doing something wrong. Please help me! Below is the code I have for starters. Since my programming skills are not great, I don’t even know how to enable the write code. Thank you very much for your help.
function readfile(){ var excel = new ActiveXObject("Excel.Application"); var excel_file = excel.Workbooks.Open("C:\Document and Settings\User\Desktop\ORDNO.xlsx"); var excel_sheet = excel_file.Worksheets("Sheet1"); var data = excel_sheet.Cells(1,1).Value = OrdNo; return data; } event.value = Ordno Excel.Quit();
source share