Sign in to follow this  
Followers 0
alaa777

Save an Excel sheet

4 posts in this topic

hi.. i want to save an Excel sheet without the save box to appear

$oExcel=_FileCreate(@ScriptDir&"\"&"Values for "&$F/1000&"Khz+-"&$Range&".xls")
        $oExcel = ObjCreate("Excel.Application")
                $oExcel.Visible = 0
                $oExcel.WorkBooks.Add
                $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,1).Value="L Value"
                $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,2).Value="C Value"
                $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,3).Value="F Value"
                                $oExcel.ActiveWorkBook.ActiveSheet.Cells($ini+1,1).Value=$Lvalus[$il]
                $oExcel.ActiveWorkBook.ActiveSheet.Cells($ini+1,2).Value=$Cvalus[$ic]
                $oExcel.ActiveWorkBook.ActiveSheet.Cells($ini+1,3).Value=$Result
                $ini=$ini+1
                                $oExcel.Save
                                Sleep(5000)
                                $oExcel.Quit 
MsgBox(0,"","Done")

Share this post


Link to post
Share on other sites



^^ i did it :D

_FileCreate(@ScriptDir&"\"&"Values for "&$F/1000&"Khz+-"&$Range&".xls")
        $oExcel = ObjCreate("Excel.Application")
                $objExcel=$oExcel.Workbooks.Open(@ScriptDir&"\"&"Values for "&$F/1000&"Khz+-"&$Range&".xls")
                $oExcel.Visible = 0
                $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,1).Value="L Value"
                $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,2).Value="C Value"
                $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,3).Value="F Value"
                                $objExcel.Save
                                $oExcel.ActiveWorkBook.Saved = 1
                                $oExcel.Quit

Share this post


Link to post
Share on other sites

ok i have another problem what if i want to insert worksheet in the same file and set a name for it??

Share this post


Link to post
Share on other sites

a. have a try with this.

b. You need to visit, the ActiveX/COM Help and Support

Local $objExcel
Local $objWorkbook
Local $objWorksheet
;#####################################################
$objExcel = ObjCreate("Excel.Application")
$objExcel.Visible = True
$objWorkbook = $objExcel.Workbooks.Add()
$objWorksheet = $objWorkbook.Worksheets(1)
$objWorksheet.Cells(1,1).Value = "Example"
$objWorksheet.Name = "Example"
$objWorkbook.Worksheets.Add.Name = "Example1"
$objWorkbook.Worksheets.Add.Name = "Example2"
$objWorkbook.Worksheets.Add.Name = "Example3"
$objWorkbook.Worksheets.Add.Name = "Example4"
$objWorkbook.Worksheets.Add.Name = "Example5"
$objWorkbook.Worksheets.Add.Name = "Example6"
$objWorksheet.Copy(Default, $objWorkbook.Worksheets(2))

Share this post


Link to post
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
Sign in to follow this  
Followers 0