Take the 2-minute tour ×

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

share|improve this question

Your Answer



Browse other questions tagged or ask your own question.