Jump to content

Excel Related


Recommended Posts

Hi,

i suppose you haven't have an excel object. See helpfile _ExcelBookOpen() or _ExcelBookAttach().

This must be before $oExcel.ActiveWorkBook....

$oExcel = _ExcelBookOpen ("<fullpath to excelworkbook>") ; or your sheet is in ScriptDir
;$oExcel = _ExcelBookOpen ("workbookname.xls")
;cleaning contents of 1.st sheet in workbook
$sheet = 1 ;can be sheet number or name
$oExcel.ActiveWorkbook.Sheets($sheet).Select ()
$oExcel.Cells().ClearContents

;-))

Stefan

Link to comment
Share on other sites

I assume too much :( thanks 99ojo.

@AnuReddy: Don't forget to finish with:

_ExcelBookSave($oExcel)
_ExcelBookClose($oExcel)

Otherwise your changes won't be saved, or excel will keep running in the background.

Link to comment
Share on other sites

$oExcel = ExcelAttach($path)

$oExcel.Application.ActiveSheet.UsedRange.clearcontents()

This is working fine for a particular active sheet but if i a particular sheet to be identified by name and then clear the contents its not working fine

Edited by AnuReddy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...