GNGNUT Posted February 6, 2019 Posted February 6, 2019 (edited) Hi guys unsure if anyone has come across this issue before, been trying fixes I'v seen on line and they don't seem to work, here is the issue: & code i use to read & Write $oExcel = _Excel_Open(False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) $oWorkbook = _Excel_BookOpen($oExcel, $Sale_Stock , False, False) Local $Saleflag = _Excel_RangeRead($oWorkbook,1,("AH1"), 2) $Saleflag = $Saleflag +1 Local $aArray2D[1][35] = [[$ND, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10, $v11, $v12, $v13, $v14, $v15, $v16, $v17, $v18, $v19, $v20, $v21, $v22, $v23, $v24, $v25, $v26, $v27, $v28, $v29, $v30, $v31, $v32,"",$cashsum ]] _Excel_RangeWrite($oWorkbook, 1, $Saleflag, "AH1", "", True ) _Excel_RangeWrite($oWorkbook, 1, $aArray2D, "A"& $Saleflag, "", True ) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Exit EndIf If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) I can create Excel document and use autoit to read and write to, when I create this out side of autoit I can open and excell and all displays fine, after writing to it via autoit and i open out side of my program I'm faced with a gray excel screen, all most like the file / data is currupt / not oping the document i have selected, if any one has any fixes or can point me to how to try and fix this would be great kind regards Gngnut same file in explorer preview mode so i know there is data in it Edited February 6, 2019 by GNGNUT took screen shots off,
Developers Jos Posted February 6, 2019 Developers Posted February 6, 2019 Moved to the appropriate forum. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
xcaliber13 Posted February 6, 2019 Posted February 6, 2019 GNGNUT I am not seeing any _Excel_BookSave or an _Excel_BookSaveAs. You are just closing excel. you open excel write in excel but do not save in excel then close excel
GNGNUT Posted February 6, 2019 Author Posted February 6, 2019 (edited) @ecaliber13 using the commands as per the helpfile there was no need to use book save, as the data is writing and being stored, if i'm reading the help file correctly Excel_close - saves the document _Excel_Close ( $oExcel [, $bSaveChanges = True [, $bForceClose = False]] ) by having the 2nd option as default, this saves the document on close, after brain stoming with a friend we worked out its coming from _Excel_BookOpen ( $oExcel, $sFilePath [, $bReadOnly = False [, $bVisible = True [, $sPassword = Default [, $sWritePassword = Default [, $bUpdateLinks = Default]]]]] ) i was reading the help file $bvisable - as stopinbg the excel poping up on screen behind / ontop of your UI when running commands this Hides the workbook within excel Directly, and prevents the excel popup when running code - you can view the data in excel when you open it by going to VIEW - unhide In order to prevent the excel document from poping up while writing I have these settings, $oExcel = _Excel_Open(False) $oWorkbook = _Excel_BookOpen($oExcel, "File" , False, true) Edited February 6, 2019 by GNGNUT
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