By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,452 Members | 974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,452 IT Pros & Developers. It's quick & easy.

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

P: 144
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.

Expand|Select|Wrap|Line Numbers
  1. var myApp = new ActiveXObject("Excel.Application"); 
  2. myApp.visible = false; 
  3. var shell = new ActiveXObject(""); 
  4.'"C:\\ROME Literature Spreadsheet.xls"',1); 
  5. WScript.sleep(5000); 
  6. shell.SendKeys("y"); 
  7. myApp.ActiveWorkbook.SaveCopyAs("C:\\goon\\today.xls");  
  8. 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.ActiveWorkbook.SaveCopyAs("C:\\goon\\today.x ls");

sometimes if there are Multiple Excel file is 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
Mar 9 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.