Jump to content

GreenCan

Active Members
  • Posts

    364
  • Joined

  • Last visited

  • Days Won

    2

Community Answers

  1. GreenCan's post in Excel merge issue: The selection contains multiple data values was marked as the answer   
    It took me a while to really find out what the issue was but I found it...
    First of all, it is not the action of merging overlapping merged ranges that causes the popup. It is when you merge cells that have already content. Flip flop the first two lines to see the effect of DisplayAlerts = False.
    ;~ $oExcel = _Excel_Open(Default, False) $oExcel = _Excel_Open(Default, True) $oWorkBook = _Excel_BookNew($oExcel, 1) _Excel_RangeWrite($oWorkbook, Default, ".", "A3:X3") $oMerged = $oWorkBook.Activesheet.Range("B3:E3").Merge $oWorkBook.Activesheet.Range("B3").Interior.Color = 250 _Excel_RangeWrite($oWorkbook, Default, "This is the second TEST", "B3") _Excel_RangeWrite($oWorkbook, Default, "This is the second TEST", "G3") $oMerged = $oWorkBook.Activesheet.Range("G3:I3").Merge $oWorkBook.Activesheet.Range("G3").Interior.Color = 153 I could not replicate the issue that I had in my Gantt script, the small example did exactly what was expected. Then I started to look at the Excel functions I used and I found that v3.3.10.2 _ExcelSheetDelete sets $oExcel.Application.DisplayAlerts = True before returning
    So the result was that it cancelled the setting that was set as per below extract of my script
    $oExcel =_ExcelBookNew ( $Visible ) ; excel Visible $oExcel.DisplayAlerts = False _ExcelSheetDelete($oExcel, 3) ; this function sets DisplayAlerts again to True _ExcelSheetDelete($oExcel, 2) solved by
    $oExcel =_ExcelBookNew ( $Visible ) ; excel Visible _ExcelSheetDelete($oExcel, 3) _ExcelSheetDelete($oExcel, 2) $oExcel.DisplayAlerts = False Conclusion:
    Issue resolved Upgrade to the latest version of AutoIt and excel udf with water's _Excel_SheetDelete (even if it will take me a couple of months to revise all my scripts...) going to enjoy my weekend now...  
×
×
  • Create New...