4

I need help with the javascript code for the following:

  1. I created a .pdf order form. The first field on the form is the order number.

  2. I would like to generate the order number automatically each time the .pdf file is opened. As well, I want it to increment by 1 starting from the number 1001 each time the order form is opened.

  3. I've stored the numeric value 1001 in cell(1,1) of an excel file.

  4. I want create a javascript to extract (Read) the current value in cell(1,1) and return that data to me.

  5. In addition, I want the same script to overwrite the current value in cell(1,1) with value + 1.

I have searched the internet extensively and found several bits of code but none of them produce the results that I want. maybe I am doing something wrong. Help please! Below is the code I have for starters. As my programming skills are not great, I have not even certain how to incorporate the Write code. Many thanks 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();
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.