How to point only to Particular file for a particular action in JavaScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidson1
    New Member
    • Feb 2008
    • 144

    How to point only to Particular file for a particular action in JavaScript

    Hi friends,

    I have a below code, which is opening a Excel file, then a Message box appears and "Y" button is pressed by default SendKey(not by keyboard) and then Excel file is showing the data. After that we are doing Save as Option and saving it as today.xls New file.

    Code:
    var myApp = new ActiveXObject("Excel.Application"); 
    myApp.visible = false; 
    var shell = new ActiveXObject("WScript.shell"); 
    shell.run('"C:\\ROME Literature Spreadsheet.xls"',1); 
    WScript.sleep(5000); 
    shell.SendKeys("y"); 
    myApp.ActiveWorkbook.SaveCopyAs("C:\\goon\\today.xls");  
    shell.SendKeys("%{F4}");
    Once the Excel file is opened and Message Box appears, "Y" keyword should be pressed only at that time. Some times if the any other user pressed "Enter" or some other Keyword(Which can be done through Keyboard) at the same time, then it will not show data. How to prevent that?

    And in the below code which is doing SaveAs option

    myApp.ActiveWor kbook.SaveCopyA s("C:\\goon\\to day.xls");

    sometimes if there are Multiple Excel file is opened..it is getting confused and pointing to some other Excel file and it is doing SaveAs option in it

    I want to point to "ROME Literature Spreadsheet.xls " only which is opened at that time.

    Is it possible?

    Thanks in Advance
Working...