konan Posted May 14, 2005 Share 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<<<<<<<< Link to comment Share on other sites More sharing options...
konan Posted May 15, 2005 Author Share Posted May 15, 2005 Who can help me? Link to comment Share on other sites More sharing options...
DaleHohm Posted May 15, 2005 Share 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, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe 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 Link to comment Share on other sites More sharing options...
konan Posted May 15, 2005 Author Share Posted May 15, 2005 Thank you very much for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now