Application Interface
Represents the entire Microsoft Excel application.
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
The Application object contains:
-
Application-wide settings and options (for example, many of the options in the Options dialog box - accessed through the Tools menu).
-
Properties that return top-level objects, such as ActiveCell, ActiveSheet, and so on.
Use the Application property to return the Application object.
JavaScript Example
function XlBook(name,visible,readonly) {
var book;
if (visible==undefined) visible = true;
if (readonly==undefined) readonly = false;
if (XlBook.app==null) XlBook.app = new ActiveXObject ("Excel.Application");
if (name) book = XlBook.app.Workbooks.Open(name,3,readonly);
else book = XlBook.app.Workbooks.Add();
XlBook.app.visible = visible;
return book;
}
XlBook.app = null;
var book;
if (visible==undefined) visible = true;
if (readonly==undefined) readonly = false;
if (XlBook.app==null) XlBook.app = new ActiveXObject ("Excel.Application");
if (name) book = XlBook.app.Workbooks.Open(name,3,readonly);
else book = XlBook.app.Workbooks.Add();
XlBook.app.visible = visible;
return book;
}
XlBook.app = null;
PowerShell Samlpe
$XLSDoc = "p:\Zeszyt1.xls"
$Excel = New-Object -ComObject "Excel.Application"
$Excel.Workbooks.Open($XLSDoc)
$Excel.Visible = $true
...
$Excel.quit()
- 2/22/2011
- MichalGajda
- 2/22/2011
- MichalGajda