konan 0 Posted May 14, 2005 I open a excel file, but not set it Visible. I del some date, then want to save it. But i find it is not to save without visible. How can it do it ? This is my code $FileName="C:\Test.xls" $oExcelDoc = ObjGet($FileName) $oExcelDoc.Worksheets(1).range("A1").Delete $a1=$oExcelDoc.Worksheets(1).range("A1").value Msgbox(0,"",$a1);>>>Show the value now ;>>>>>>>>>How to save this Excel file???<<<<<<<< ;>>>>>>>>>Don't activate it<<<<<<<< Share this post Link to post Share on other sites
DaleHohm 65 Posted May 15, 2005 Who can help me?<{POST_SNAPBACK}>Here you go:$FileName="C:\Test.xls" ; Open an Excel Workbook Object $oExcelWB = ObjGet($FileName) ; Oddly, even though we will not show the Excel interface in this example ; (with $oExcelWB.Application.Visible = 1), if you don't explicitly make the ; window object visible before saving the workbook the window will be invisible ; when you open interactivly $oExcelWB.Windows(1).Visible = 1 ; Delete the contents of A1 $oExcelWB.Worksheets(1).range("A1").Delete ; Obtain the new A1 value and display in a MsgBox $a1=$oExcelWB.Worksheets(1).range("A1").value Msgbox(0,"",$a1);>>>Show the value now ; Save the workbook back to the file and close the workbook $result = $oExcelWB.Save $result = $oExcelWB.Close ExitDale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curlMSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object modelAutomate input type=file (Related)Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better?IE.au3 issues with Vista - WorkaroundsSciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Share this post Link to post Share on other sites
konan 0 Posted May 15, 2005 Thank you very much for your help! Share this post Link to post Share on other sites