Jump to content

water

MVPs
  • Posts

    26,776
  • Joined

  • Last visited

  • Days Won

    206

water last won the day on November 19 2025

water had the most liked content!

About water

Recent Profile Visitors

15,193 profile views

water's Achievements

  1. It seems to be invalid to create a "follow-up task" and set it to "completed" in one go.
  2. Dear Robertocm, I had a quick look at the OutlookEx UDF and noticed, that there is only a single function available to work with "follow-up tasks": _OL_Item2Task Seems that not many users had the need for this or further functions. So I need to do some investigation and create functions to query and modify "follow-up tasks". I think I found some good VBA code to query such tasks and hope to come up with a AutoIt function quite soon. Please stay tuned
  3. Thanks for your contribution but I'm not sure what do with your test results: Is this post for a user who had a question regarding the FlagStatus property? Should I add the listed constants to the UDF? Something else?
  4. Strange πŸ€” As we have a working solution for strings you could loop through the array and move cell by cell. This will slow down your script, so it depends on the size of your array if this is a solution for you. If our solution for strings does not work when passing an array cell, then please copy the array cell to variable and then call our solution.
  5. Quick and Dirty: Your data gets written to a temporary Range and then copied to the range specified by you. If this works thenthis code needs to be made more flexible and cleanup the temp. data etc. #include <Excel.au3> Global $aArray[1][4] $aArray[0][0] = "1" For $i = 1 to 8203 $aArray[0][1] &= "A" Next For $i = 1 to 8204 $aArray[0][2] &= "B" Next $aArray[0][3] = 2 ConsoleWrite("String length of Array[0][1]: " & StringLen($aArray[0][1]) & @CRLF) ConsoleWrite("String length of Array[0][2]: " & StringLen($aArray[0][2]) & @CRLF) Local $oError = ObjEvent("AutoIt.Error", "_ErrorHandler") $Excel = _Excel_Open() $ExcelBook = _Excel_BookNew($Excel) _Excel_RangeWriteEX($ExcelBook, Default, $aArray, "A1", True, True) If @Error then MsgBox(0, "Error", "Error _Excel_RangeWriteEX: " & @error & @CRLF & "Extended: " & @extended) ; #FUNCTION# ==================================================================================================================== ; Author ........: SEO <locodarwin at yahoo dot com> ; Modified.......: litlmike, PsaltyDS, Golfinhu, water ; =============================================================================================================================== Func _Excel_RangeWriteEX($oWorkbook, $vWorksheet, $vValue, $vRange = Default, $bValue = Default, $bForceFunc = Default) ; Error handler, automatic cleanup at end of function ; Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc") #forceref $oError If Not IsObj($oWorkbook) Or ObjName($oWorkbook, 1) <> "_Workbook" Then Return SetError(1, 0, 0) If Not IsObj($vWorksheet) Then If $vWorksheet = Default Then $vWorksheet = $oWorkbook.ActiveSheet Else $vWorksheet = $oWorkbook.WorkSheets.Item($vWorksheet) EndIf If @error Or Not IsObj($vWorksheet) Then Return SetError(2, @error, 0) ElseIf ObjName($vWorksheet, 1) <> "_Worksheet" Then Return SetError(2, @error, 0) EndIf If $vRange = Default Then $vRange = "A1" If $bValue = Default Then $bValue = True If $bForceFunc = Default Then $bForceFunc = False If Not IsObj($vRange) Then $vRange = $vWorksheet.Range($vRange) If @error Or Not IsObj($vRange) Then Return SetError(3, @error, 0) EndIf If Not IsArray($vValue) Then If $bValue Then $vRange.Value = $vValue Else $vRange.Formula = $vValue EndIf If @error Then Return SetError(4, @error, 0) Else If $vRange.Columns.Count = 1 And $vRange.Rows.Count = 1 Then If UBound($vValue, 0) = 1 Then $vRange = $vRange.Resize(UBound($vValue, 1), 1) Else $vRange = $vRange.Resize(UBound($vValue, 1), UBound($vValue, 2)) EndIf EndIf If $bForceFunc Then _ArrayTranspose($vValue) If $bValue Then Local $vRange2 = $vWorksheet.Range("A3:D3") ; Added $vRange2.Value = $vValue ; Added $vWorksheet.Range("A1:D1") = $vRange2.Value ; Added ; $vRange.Value = $vValue ; Dropped Else $vRange.Formula = $vValue EndIf If @error Then Return SetError(5, @error, 0) Else Local $oExcel = $oWorkbook.Parent If $bValue Then $vRange.Value = $oExcel.Transpose($vValue) Else $vRange.Formula = $oExcel.Transpose($vValue) EndIf If @error Then Return SetError(6, @error, 0) EndIf EndIf Return $vRange EndFunc ;==>_Excel_RangeWriteEX ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: _ErrorHandler ; Description ...: Called if an ObjEvent error occurs. ; Syntax.........: __Outlook_ErrorHandler() ; Parameters ....: None ; Return values .: @error is set to the COM error by AutoIt ; Author ........: water ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ErrorHandler() Local $sError = "COM Error Encountered in " & @ScriptName & @CRLF & _ "@AutoItVersion = " & @AutoItVersion & @CRLF & _ "@AutoItX64 = " & @AutoItX64 & @CRLF & _ "@Compiled = " & @Compiled & @CRLF & _ "@OSArch = " & @OSArch & @CRLF & _ "@OSVersion = " & @OSVersion & @CRLF & _ "Scriptline = " & $oError.Scriptline & @CRLF & _ "NumberHex = 0x" & Hex($oError.Number, 8) & @CRLF & _ "Number = " & $oError.Number & @CRLF & _ "WinDescription = " & StringStripWS($oError.WinDescription, $STR_STRIPTRAILING) & @CRLF & _ "Description = " & StringStripWS($oError.Description, $STR_STRIPTRAILING) & @CRLF & _ "Source = " & $oError.Source & @CRLF & _ "HelpFile = " & $oError.HelpFile & @CRLF & _ "HelpContext = " & $oError.HelpContext & @CRLF & _ "LastDllError = " & $oError.LastDllError ConsoleWrite($sError & @CRLF) EndFunc ;==>_ErrorHandler
  6. Great!! The difference between working and not working is the use of ".Value" in the assignment statement. Seems Excel is a bit overly precise here - but doesn't tell us Could you please run the following script? It's an extended version of your first script with added COM error handling. So we know if there are more problems we need to handle. The error messages get written to the Console. #include <Excel.au3> Global $aArray[1][4] $aArray[0][0] = "1" For $i = 1 to 8203 $aArray[0][1] &= "A" Next For $i = 1 to 8204 $aArray[0][2] &= "B" Next $aArray[0][3] = 2 ConsoleWrite("String length of Array[0][1]: " & StringLen($aArray[0][1]) & @CRLF) ConsoleWrite("String length of Array[0][2]: " & StringLen($aArray[0][2]) & @CRLF) Local $oError = ObjEvent("AutoIt.Error", "_ErrorHandler") $Excel = _Excel_Open() $ExcelBook = _Excel_BookNew($Excel) _Excel_RangeWriteEX($ExcelBook, Default, $aArray, "A1", True, True) If @Error then MsgBox(0, "Error", "Error _Excel_RangeWriteEX: " & @error & @CRLF & "Extended: " & @extended) ; #FUNCTION# ==================================================================================================================== ; Author ........: SEO <locodarwin at yahoo dot com> ; Modified.......: litlmike, PsaltyDS, Golfinhu, water ; =============================================================================================================================== Func _Excel_RangeWriteEX($oWorkbook, $vWorksheet, $vValue, $vRange = Default, $bValue = Default, $bForceFunc = Default) ; Error handler, automatic cleanup at end of function ; Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc") #forceref $oError If Not IsObj($oWorkbook) Or ObjName($oWorkbook, 1) <> "_Workbook" Then Return SetError(1, 0, 0) If Not IsObj($vWorksheet) Then If $vWorksheet = Default Then $vWorksheet = $oWorkbook.ActiveSheet Else $vWorksheet = $oWorkbook.WorkSheets.Item($vWorksheet) EndIf If @error Or Not IsObj($vWorksheet) Then Return SetError(2, @error, 0) ElseIf ObjName($vWorksheet, 1) <> "_Worksheet" Then Return SetError(2, @error, 0) EndIf If $vRange = Default Then $vRange = "A1" If $bValue = Default Then $bValue = True If $bForceFunc = Default Then $bForceFunc = False If Not IsObj($vRange) Then $vRange = $vWorksheet.Range($vRange) If @error Or Not IsObj($vRange) Then Return SetError(3, @error, 0) EndIf If Not IsArray($vValue) Then If $bValue Then $vRange.Value = $vValue Else $vRange.Formula = $vValue EndIf If @error Then Return SetError(4, @error, 0) Else If $vRange.Columns.Count = 1 And $vRange.Rows.Count = 1 Then If UBound($vValue, 0) = 1 Then $vRange = $vRange.Resize(UBound($vValue, 1), 1) Else $vRange = $vRange.Resize(UBound($vValue, 1), UBound($vValue, 2)) EndIf EndIf If $bForceFunc Then _ArrayTranspose($vValue) If $bValue Then $vRange.Value = $vValue Else $vRange.Formula = $vValue EndIf If @error Then Return SetError(5, @error, 0) Else Local $oExcel = $oWorkbook.Parent If $bValue Then $vRange.Value = $oExcel.Transpose($vValue) Else $vRange.Formula = $oExcel.Transpose($vValue) EndIf If @error Then Return SetError(6, @error, 0) EndIf EndIf Return $vRange EndFunc ;==>_Excel_RangeWriteEX ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: _ErrorHandler ; Description ...: Called if an ObjEvent error occurs. ; Syntax.........: __Outlook_ErrorHandler() ; Parameters ....: None ; Return values .: @error is set to the COM error by AutoIt ; Author ........: water ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ErrorHandler() Local $sError = "COM Error Encountered in " & @ScriptName & @CRLF & _ "@AutoItVersion = " & @AutoItVersion & @CRLF & _ "@AutoItX64 = " & @AutoItX64 & @CRLF & _ "@Compiled = " & @Compiled & @CRLF & _ "@OSArch = " & @OSArch & @CRLF & _ "@OSVersion = " & @OSVersion & @CRLF & _ "Scriptline = " & $oError.Scriptline & @CRLF & _ "NumberHex = 0x" & Hex($oError.Number, 8) & @CRLF & _ "Number = " & $oError.Number & @CRLF & _ "WinDescription = " & StringStripWS($oError.WinDescription, $STR_STRIPTRAILING) & @CRLF & _ "Description = " & StringStripWS($oError.Description, $STR_STRIPTRAILING) & @CRLF & _ "Source = " & $oError.Source & @CRLF & _ "HelpFile = " & $oError.HelpFile & @CRLF & _ "HelpContext = " & $oError.HelpContext & @CRLF & _ "LastDllError = " & $oError.LastDllError ConsoleWrite($sError & @CRLF) EndFunc ;==>_ErrorHandler
  7. Step 1: Done Step 2: Done Could you please create 2 AutoIt scripts from the following code and test Error8204.au3 (and hopefully get an error msgbox as I did), then run Working8204.au3 and - keep your fingers crossed - get no error. Please post your results ; Error8204.au3 #include <Excel.au3> Local $sX, $oExcel, $oWorkBook, $oActiveWorksheet For $i = 1 To 8204 $sX &= "B" Next ConsoleWrite("String length of $sX: " & StringLen($sX) & @CRLF) $oExcel = _Excel_Open() If @error Then MsgBox(0, "Error", "_Excel_Open Error: " & @error & @CRLF & "Extended: " & @extended) $oWorkBook = _Excel_BookNew($oExcel) If @error Then MsgBox(0, "Error", "_Excel_BookNew Error: " & @error & @CRLF & "Extended: " & @extended) ; _Excel_RangeWrite($ExcelBook, Default, $Array, "A1") ; , True, True) $oActiveWorksheet = $oWorkBook.ActiveSheet If @error Then MsgBox(0, "Error", "Get active Sheet Error: " & @error & @CRLF & "Extended: " & @extended) $oActiveWorksheet.Range("A1").Value = $sX If @error Then MsgBox(0, "Error", "_Assign to Range A1 Error: " & @error & @CRLF & "Extended: " & @extended) $oActiveWorksheet.Range("A2") = $oActiveWorksheet.Range("A1") If @error Then MsgBox(0, "Error", "_Assign to Range A2 Error: " & @error & @CRLF & "Extended: " & @extended) ; Working8204.au3 #include <Excel.au3> Local $sX, $oExcel, $oWorkBook, $oActiveWorksheet For $i = 1 To 8204 $sX &= "B" Next ConsoleWrite("String length of $sX: " & StringLen($sX) & @CRLF) $oExcel = _Excel_Open() If @error Then MsgBox(0, "Error", "_Excel_Open Error: " & @error & @CRLF & "Extended: " & @extended) $oWorkBook = _Excel_BookNew($oExcel) If @error Then MsgBox(0, "Error", "_Excel_BookNew Error: " & @error & @CRLF & "Extended: " & @extended) $oActiveWorksheet = $oWorkBook.ActiveSheet If @error Then MsgBox(0, "Error", "Get active Sheet Error: " & @error & @CRLF & "Extended: " & @extended) $oActiveWorksheet.Range("A1").Value = $sX If @error Then MsgBox(0, "Error", "_Assign to Range A1 Error: " & @error & @CRLF & "Extended: " & @extended) $oActiveWorksheet.Range("A2") = $oActiveWorksheet.Range("A1").Value If @error Then MsgBox(0, "Error", "_Assign to Range A2 Error: " & @error & @CRLF & "Extended: " & @extended)
  8. This site describes the problem you see and offers a working solution as well. Seems you need to create a user function (like _Excel_RangeWriteSpecial), copy _Excel_RangeWrite to your function and insert the lines described after "I was able to solve the error by adding .value to the copy." First we need an AutoIt script to reproduce the problem with a string as described on the mentioned site Next step is to translate the solution to AutoIt Last step is to modify the solution for an array I'm working on step 1 at the moment
  9. User DCCD has not been active for more than two years. So don't hold your breath while waiting for a reply πŸ˜‰
  10. Your script runs without errors here. I only had to set the overwrite parameter in _Excel_BooksSaveAs to True. Which version of Excel do you run? The internal limits depend on the used version as described here.
  11. Maybe the H2Au3 tool from the german forum helps to create structures for AutoIt πŸ€”It's old, it's beta and far from perfect, but it might save you a few minutes https://autoit.de/thread/23604-h2au3/?postID=192084&highlight=h2au3#post192084 Here is the translated post: Hi, I’d like to introduce you to a tool that lets you convert C constants, function declarations, and structure definitions into AutoIt code. The program is still in the beta stage and will eventually be able to translate entire C header files (not everything, but what it can handle). It can also be used to translate function declarations and structure definitions from the MSDN Developer Library (this already works quite well). Since h2au3 isn’t perfect, you’ll need to make some manual corrections here and there, such as the last parameter in the example below, which represents a structure (BLENDFUNCTION). The preview version is attached. Usage: Clipboard: Start h2au3, copy a function/structure from MSDN or a C header file, e.g., AlphaBlend. Copy the function syntax to the clipboard, select what you want to convert—in this case, a function or simply select “All”—and press “F5.” Done. Compiling a header file: Select a C header file via the “File | Open” menu. Select the “Tools | Start” menu item or press “F5”. Done. Quick alternative: Drag and drop a C header file into the window. Done. MSDN Search: Select the menu item “View | Search Bar.” A toolbar with an input field will appear. Enter the name of a function or structure in the input field and press the “Search” button or “F3.” Done Translated with DeepL.com (free version)
  12. Added your UDF to the wiki
  13. My post was meant for user xuankhanh1982 (hence I quoted his post). Just telling us that "it doesn't work" is not very helpful. He should at least post the information that is at his fingertips
  14. Can you please post the console output of Au3Stripper? Most of the time the messages tell you which statements might cause a problem.
×
×
  • Create New...