Jump to content

Update the Excel UDF that comes with AutoIt


water
 Share

Recommended Posts

Maybe the same or a similar bug as reported >here.

Could you intall beta version 3.3.11.3 and give it a try?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

OK, got this from my script, does not load the excel into array, but maybe this will help?

 

AutoIt COM error handler -:
  @AutoItVersion = 3.3.11.3
  @AutoItX64 = 0
  @Compiled = 0
  @OSArch = X86
  @OSVersion = WIN_7
  Scriptline = 667
  NumberHex = 80020005
  Number = -2147352571
  WinDescription = Type mismatch.
  Description =
  Source =
  HelpFile =
  HelpContext =
  LastDllError = 0

Ran it again as it as it said there might be some @Exteneded info that number was -2147352571

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Which version of the Excel UDF do you use? In Beta 4 line 667 is a comment.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I have tried using your other versions, but keep getting erros:

Here is the error from your most resent version beta4

P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(170,56) : ERROR: ObjGet() [built-in] called with wrong number of args.
        $oWorkbook = ObjGet("", $sCLSID_Workbook, $iCount + 1)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(251,57) : ERROR: ObjGet() [built-in] called with wrong number of args.
            $oWorkbook = ObjGet("", $sCLSID_Workbook, $iIndex + 1)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\Qtip_nmc_02132014.au3(4532,73) : ERROR: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, Default, True, False, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\Qtip_nmc_02132014.au3(4749,73) : ERROR: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, Default, True, False, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\Qtip_nmc_02132014.au3(5901,70) : ERROR: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, False, True, True, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(1221,27) : ERROR: _ArrayTranspose(): undefined function.
        _ArrayTranspose($vResult)
        ~~~~~~~~~~~~~~~~~~~~~~~~^

edit

move to code box

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Using the Beta version of AutoIt I get these

"P:\Autoit\files\Qtip_nmc_02132014.au3"(4532,73) : error: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, Default, True, False, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3"(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\Qtip_nmc_02132014.au3"(4749,73) : error: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, Default, True, False, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3"(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\Qtip_nmc_02132014.au3"(5901,70) : error: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, False, True, True, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3"(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\Qtip_nmc_02132014.au3 - 3 error(s), 0 warning(s)

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

 

Here is my take on the three functions:

_Excel_ControlAdd_Combo

_Excel_ControlAdd_ComboItem

_Excel_ControlRead_Combo

Func _Excel_ControlAdd_Combo($oWorkbook, $vWorksheet, $vRangeOrLeft, $iTop = Default, $iWidth = Default, $iHeight = Default)
    Local $Return, $iPosLeft, $iPosTop
    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 IsNumber($vRangeOrLeft) Then
        $iPosLeft = $vRangeOrLeft
        $iPosTop = $iTop
    Else
        If Not IsObj($vRangeOrLeft) Then
            $vRangeOrLeft = $vWorksheet.Range($vRangeOrLeft)
            If @error Or Not IsObj($vRangeOrLeft) Then Return SetError(3, @error, 0)
        EndIf
        $iPosLeft = $vRangeOrLeft.Left
        $iPosTop = $vRangeOrLeft.Top
    EndIf
    If IsNumber($vRangeOrLeft) Or ($vRangeOrLeft.Columns.Count = 1 And $vRangeOrLeft.Rows.Count = 1) Then
        If $iWidth = Default Or $iHeight = Default Then Return SetError(5, 0, 0)
        $Return = $vWorksheet.DropDowns.Add($iPosLeft, $iPosTop, $iWidth, $iHeight)
        If @error Then Return SetError(4, @error, 0)
    Else
        Local $iRw = $vRangeOrLeft.Width
        Local $iRh = $vRangeOrLeft.Height
        $Return = $vWorksheet.DropDowns.Add($iPosLeft, $iPosTop, $vRangeOrLeft.Width, $vRangeOrLeft.Height)
        If @error Then Return SetError(4, @error, 0)
    EndIf
    Return $Return
EndFunc   ;==>_Excel_ControlAdd_Combo

Func _Excel_ControlAdd_ComboItem(ByRef $hCombo, $sValue)
    If Not IsObj($hCombo) Then Return SetError(1, @error, 0)
    $hCombo.AddItem($sValue)
    If @error Then Return SetError(2, @error, 0)
EndFunc   ;==>_Excel_ControlAdd_ComboItem

Func _Excel_ControlRead_Combo(ByRef $hCombo)
    Local $Return, $iIndex
    If Not IsObj($hCombo) Then Return SetError(1, @error, 0)
    $iIndex = $hCombo.Value
    If $iIndex = 0 Then Return -1
    $Return = $hCombo.List($iIndex)
    If @error Then Return SetError(2, @error, 0)
    Return $Return
EndFunc   ;==>_Excel_ControlRead_Combo

Example included below.

#include "Excel Rewrite.au3"
#include <Constants.au3>

; Create application object and open an example workbook
Global $oAppl = _Excel_Open()
If @error <> 0 Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function.", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
; Create new Workbook
Global $oWorkbook = _Excel_BookNew($oAppl)
If @error <> 0 Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function Example", "Error creating workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($oAppl)
    Exit
EndIf

Local $hEx1, $hEx2, $hEx3

$hEx1 = Example1($oWorkbook)
$hEx2 = Example2($oWorkbook)
$hEx3 = Example3($oWorkbook)
Example4($hEx1)
Example5($hEx1)

Exit

; *****************************************************************************
; Example 1
; Add a combo control that will fill the specified range.
; *****************************************************************************
Func Example1($oWorkbook)
    Local $oRet = _Excel_ControlAdd_Combo($oWorkbook, Default, "B2:G3")
    If @error <> 0 Then Return MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function Example 1", "Error adding combo control." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function Example 1", "Added combo control at 'B2:G3', filling the size of the range.")
    Return $oRet
EndFunc   ;==>Example1

; *****************************************************************************
; Example 2
; Add a combo control at a specified cell location but set a specific width and height.
; *****************************************************************************
Func Example2($oWorkbook)
    Local $oRet = _Excel_ControlAdd_Combo($oWorkbook, Default, "B7", Default, 200, 20)
    If @error <> 0 Then Return MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function Example 2", "Error adding combo control." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function Example 2", "Added combo control at 'B7' 200 in width, 20 in height.")
    Return $oRet
EndFunc   ;==>Example2

; *****************************************************************************
; Example 3
; Add a combo control at a specified left and top location while specifying width and height.
; *****************************************************************************
Func Example3($oWorkbook)
    Local $oRet = _Excel_ControlAdd_Combo($oWorkbook, Default, 200, 250, 300, 25)
    If @error <> 0 Then Return MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function Example 3", "Error adding combo control." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_Combo function Example 3", "Added combo control at 200 left, 250 top, 300 in width, 25 in height.")
    Return $oRet
EndFunc   ;==>Example3

; *****************************************************************************
; Example 4
; Add comboitems to a combobox
; *****************************************************************************
Func Example4($hControl)
    _Excel_ControlAdd_ComboItem($hControl, "testing option1")
    If @error <> 0 Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_ComboItem", "Error adding comboitem." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_ControlAdd_ComboItem($hControl, "testing option2")
    If @error <> 0 Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_ComboItem", "Error adding comboitem." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_ControlAdd_ComboItem($hControl, "testing option3")
    If @error <> 0 Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_ComboItem", "Error adding comboitem." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
EndFunc   ;==>Example4

; *****************************************************************************
; Example 5
; Read a combobox and display the result in a MsgBox
; *****************************************************************************
Func Example5($hControl)
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_ComboItem", "Added options to first example combobox." & @CRLF & @CRLF & "Please select one and click OK to have the selected option read.")
    Local $sResult = _Excel_ControlRead_Combo($hControl)
    If @error <> 0 Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlRead_Combo", "Error reading combo." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    If $sResult = -1 Then $sResult = "YOU DID NOT SELECT AN ITEM"
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: Testing _Excel_ControlAdd_ComboItem", "You selected: " & $sResult)
EndFunc   ;==>Example5

Func _Excel_ControlRead_Combo(ByRef $hCombo)
    Local $Return, $iIndex
    If Not IsObj($hCombo) Then Return SetError(1, @error, 0)
    $iIndex = $hCombo.Value
    If $iIndex = 0 Then Return -1
    $Return = $hCombo.List($iIndex)
    If @error Then Return SetError(2, @error, 0)
    Return $Return
EndFunc   ;==>_Excel_ControlRead_Combo

Func _Excel_ControlAdd_ComboItem(ByRef $hCombo, $sValue)
    If Not IsObj($hCombo) Then Return SetError(1, @error, 0)
    $hCombo.AddItem($sValue)
    If @error Then Return SetError(2, @error, 0)
EndFunc   ;==>_Excel_ControlAdd_ComboItem

Func _Excel_ControlAdd_Combo($oWorkbook, $vWorksheet, $vRangeOrLeft, $iTop = Default, $iWidth = Default, $iHeight = Default)
    Local $Return, $iPosLeft, $iPosTop
    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 IsNumber($vRangeOrLeft) Then
        $iPosLeft = $vRangeOrLeft
        $iPosTop = $iTop
    Else
        If Not IsObj($vRangeOrLeft) Then
            $vRangeOrLeft = $vWorksheet.Range($vRangeOrLeft)
            If @error Or Not IsObj($vRangeOrLeft) Then Return SetError(3, @error, 0)
        EndIf
        $iPosLeft = $vRangeOrLeft.Left
        $iPosTop = $vRangeOrLeft.Top
    EndIf
    If IsNumber($vRangeOrLeft) Or ($vRangeOrLeft.Columns.Count = 1 And $vRangeOrLeft.Rows.Count = 1) Then
        If $iWidth = Default Or $iHeight = Default Then Return SetError(5, 0, 0)
        $Return = $vWorksheet.DropDowns.Add($iPosLeft, $iPosTop, $iWidth, $iHeight)
        If @error Then Return SetError(4, @error, 0)
    Else
        Local $iRw = $vRangeOrLeft.Width
        Local $iRh = $vRangeOrLeft.Height
        $Return = $vWorksheet.DropDowns.Add($iPosLeft, $iPosTop, $vRangeOrLeft.Width, $vRangeOrLeft.Height)
        If @error Then Return SetError(4, @error, 0)
    EndIf
    Return $Return
EndFunc   ;==>_Excel_ControlAdd_Combo

 Thanks DW1 for the example. :)

Agree that a separate UDF will be good. Water, hope to see your next UDF project soon. :)

Link to comment
Share on other sites

I have tried using your other versions, but keep getting erros:

Here is the error from your most resent version beta4

P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(170,56) : ERROR: ObjGet() [built-in] called with wrong number of args.
        $oWorkbook = ObjGet("", $sCLSID_Workbook, $iCount + 1)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3(251,57) : ERROR: ObjGet() [built-in] called with wrong number of args.
            $oWorkbook = ObjGet("", $sCLSID_Workbook, $iIndex + 1)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

You can't use the rewrite of the Excel UDF with AutoIt 3.3.8.1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

 

Using the Beta version of AutoIt I get these

"P:\Autoit\files\Qtip_nmc_02132014.au3"(4532,73) : error: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, Default, True, False, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3"(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\Qtip_nmc_02132014.au3"(4749,73) : error: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, Default, True, False, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3"(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\Qtip_nmc_02132014.au3"(5901,70) : error: _Excel_Open() called with wrong number of args.
    Local $oOExcel = _Excel_Open(False, Default, False, True, True, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"P:\Autoit\files\water excel\BETA4\Beta\Excel Rewrite Beta 4\Excel rewrite.au3"(82,140) : REF: definition of _Excel_Open().
Func _Excel_Open($bVisible = Default, $bDisplayAlerts = Default, $bScreenUpdating = Default, $bInteractive = Default, $bForceNew = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
P:\Autoit\files\Qtip_nmc_02132014.au3 - 3 error(s), 0 warning(s)

As the error message tells: You are passing the wrong number of arguments. Please check the help files for the function!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

 Thanks DW1 for the example. :)

Agree that a separate UDF will be good. Water, hope to see your next UDF project soon. :)

I'm not sure that such an UDF is needed. Not too many users have asked for such a beast.

But first I need to finish the rewrite of the Excel UDF and make it a part of the next beta version of AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Released Beta 5 of the UDF.

For download and a history of changes please see post #1.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The rewrite of the Excel UDF has been added to the repository and now replaces the Excel UDF you used up to AutoIt 3.3.10.2.

If you have any questions please post in the >General Help & Support thread.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

So does that mean it will be in the next version? Guess I am confused about the repsitory.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

It will be in the next beta for you to play with :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

nitekram,

 

does that mean it will be in the next version?

Yes. The repository is where the "committed" set of AutoIt files are kept and from where they are compiled into the next release - it is part of a versioning system which allows those with permission to add, change, change back, delete, etc the multitude of files which make up AutoIt. :)

M23

P.S. And as water has opened a new thread - this one is now closed. :)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 months later...

Hi water,

I'm using Excel Rewrite Beta 4 and encounter some problem(same problem with Excel Rewrite Beta 5). Seems to be a limitation just want to confirm with you.

Local $Array = _Excel_RangeRead($oExcelWorkbook, Default, $oExcelWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 3)

This does not work. I gotten @error 5. If I was to change the $iReturn value from 3(text) to value 1, it works perfectly. Any explaination why getting the displayed text doesn't work? Btw, my data are all date and time thus I have to use $iReturn 3, else I'm getting all those weird numbers. I have also tested using single cell with iReturn 3 and they work too. It just doesn't work with array. TIA.

Edited by lolipop
Link to comment
Share on other sites

Have you upgraded to AutoIt 3.3.12.0? The Excel Rewrite Beta has replaced the Excel UDF in AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Have you upgraded to AutoIt 3.3.12.0? The Excel Rewrite Beta has replaced the Excel UDF in AutoIt.

I can't upgrade on the original machine else the script will break(some old command). But I have tested AutoIt 3.3.12.0 on another machine and I created some dummy excel and run the mention _Excel_RangeRead with iReturn 3 but the result is the same. @error = 5.

Link to comment
Share on other sites

Could you please try by setting parameter $bForceFunc = True?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Could you please try by setting parameter $bForceFunc = True?

doesn' work either

it seems iReturn 3 only works if I specific 1 single cell. it doesn't seems to work across multiple cells range.

Edited by lolipop
Link to comment
Share on other sites

Could you please add some debugging statements at the top of your script?

#include <Debug.au3>
_DebugSetup()
_DebugCOMError()

This should give more detailed information about the COM error.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...