Imaginativeone
New Member
- Joined
- Mar 6, 2008
- Messages
- 9
All of this code works like a charm, except for the following:
iWorkbook.Sheets("testSheet").Move + " After:=" + iWorkbook.Sheets(2);
How do I code the Move function with JavaScript? I've tried fixing the spacing, the correct object appears to be in operation.
Many, many thanks for your help.
iWorkbook.Sheets("testSheet").Move + " After:=" + iWorkbook.Sheets(2);
How do I code the Move function with JavaScript? I've tried fixing the spacing, the correct object appears to be in operation.
Many, many thanks for your help.
Code:
///////////////////////////////////////////////////////////////////////////
// //
// function serviceInitExcel($scope) //
// Version: //
// Description: Initialize Excel Spreadsheet //
// Date: //
// To Do: //
// Author: //
// //
///////////////////////////////////////////////////////////////////////////
var serviceInitExcel = function() {
var _SCFR;
var _filename = "emptyServiceValue";
var _serviceBrowser = "";
var service = {};
service.soundOff = function() {
alert("Another generic method");
}
service.initExcel = function() {
var _scfr = new ActiveXObject("Excel.Application");
_scfr.Visible = true;
_scfr.Workbooks.Add;
// alert("Application Initialized: " + _scfr.Name);
_SCFR = _scfr;
return _SCFR;
} // genericMethod
service.createSheet = function(iWorkbook, sheetName) {
var pblSheet = iWorkbook.Sheets("Payable");
pblSheet.Range("A1").Value = "Payable Sheet";
pblSheet.Select;
var newSheet = iWorkbook.Worksheets.Add;
newSheet.Name = sheetName;
newSheet.Select
newSheet.Range("A1").Value = "_SCFR.Name: " + _SCFR.Name;
newSheet.Range("A2").Value = "ActiveWorkbook: " + _SCFR.ActiveWorkbook.Name;
newSheet.Range("A3").Value = "Sheet 1: " + _SCFR.ActiveWorkbook.Sheets(1).Name;
newSheet.Range("A4").Value = "Sheet 2: " + _SCFR.ActiveWorkbook.Sheets(2).Name;
newSheet.Range("A5").Value = "Sheet 3: " + _SCFR.ActiveWorkbook.Sheets(3).Name;
newSheet.Range("A6").Value = "testSheet: " + iWorkbook.Sheets("testSheet").Name;
newSheet.Range("A7").Value = "Payable: " + iWorkbook.Sheets("Payable").Name;
newSheet.Range("A8").Value = "Paid: " + iWorkbook.Sheets("Paid").Name;
/* for (var s=0; s < 10; s++) {
newSheet.Range("A9").Value = s;
newSheet.Select
iWorkbook.Sheets("Payable").Select
} */
// for (var i=0; i < 4; i++) { a.Selection.Insert + " Shift:=xlDown"; }
iWorkbook.Sheets("testSheet").Move + " After:=" + iWorkbook.Sheets(2);
// newSheet.Move + "After:=" + iWorkbook.Sheets(3);
// Sheets("Payable").Select
// Sheets.Add
// Sheets("Sheet6").Select
// Sheets("Sheet6").Move After:=Sheets(3)
// _SCFR.Workbooks("Book1.xlsx").Sheets("testSheet").Move + "After:=" + _SCFR.Workbooks("Book1.xlsx").Sheets("Payable");
return iWorkbook;
} // genericMethod
return service;
}
Last edited: