You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
<SCRIPT LANGUAGE=JAVASCRIPT>
var currentDate = new Date();
var date1 = currentDate.getDate();
var mon = currentDate.getMonth()+1;
var year = currentDate.getYear();
var today = date1+"/"+mon+"/"+year;
var filePath = "C:\Users\Izzy\Desktop\123456.xlsx";
function setDate()
{
f1.tDate.value=today;
}
function saveToExcel()
{
var myApp = new ActiveXObject("Excel.Application");
myApp.visible = true;
var xlCellTypeLastCell = 11;
var myWorkbook = myApp.Workbooks.Open(C:\Users\Izzy\Desktop\123456. xlsx);
var myWorksheet = myWorkbook.Worksheets(1);
myWorksheet.Activate;
objRange = myWorksheet.UsedRange;
var filePath = "C:\Users\Izzy\Desktop\123456.xlsx";
should be
Code:
var filePath = "C:\\Users\\Izzy\\Desktop\\123456.xlsx";
and then you don't use the variable later:
Code:
var myWorkbook = myApp.Workbooks.Open(C:\Users\Izzy\Desktop\123456.xlsx);
You don't specify to save changes:
Code:
myWorkbook.Close(true);
Security permissions must be altered to allow saving to a local folder. If you are running this file directly from your machine consider renaming it to .HTA and look at HTML Applications on msdn.com.
HI, Thanks for the INSTANT REPLY ..i really appreciate that ..i am not too good with java script ...but good with html ..is there any example that u could post or a link that i can visit that explains how it is done as i am working on this since morning ..and there's NO luck and have to make sure this is done by next day morning ..thanks for the help.