Jump to content

Extended Com error (excel UDF)


Recommended Posts

Hi guys,

without including everything (unless you want it)

I am copying data from a table in chrome and wanting to paste it into excel.

Copying in Chrome works.

I can paste it into the field i want by emulating goto -> ctrl V:

WinActivate($dataload)
    WinWaitActive($dataload)
    Sleep(500)
    $oWorkbook1.Sheets("ItemReturn").Activate
    Sleep(500)
    $msg = "Measuring Sheet"
    conwrite()
    ttips2()
    Local Const $xlUp = -4162
    With $oWorkbook1.ActiveSheet ; process active sheet
        $oRangeLast = .UsedRange.SpecialCells($xlCellTypeLastCell) ; get a Range that contains the last used cells
        $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, "B")).Rows.Count ; get the the row count for the range starting in row/column 1 and ending at the last used row/column
        $iLastCell = .Cells($iRowCount + 1, "B").End($xlUp).Row ; start in the row following the last used row and move up to the first used cell in column "B" and grab this row number
    
    EndWith
    $NewStartCell = $iLastCell + 2

    $msg = "moving to location"
    conwrite()
    ttips2()
    Sleep(250)
    Send("^g")
    WinWait("Go To")
    Sleep(100)
    Send("B" & $NewStartCell)
    Sleep(100)
    Send("{ENTER}")
    Sleep(500)
    Send("^v")

 

But, I want to use _excel_rangecopypaste, pasting from the clipboard

_Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, default, "B" & $NewStartCell,default,$xlPasteValuesAndNumberFormats)
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 2", "Error pasting cells." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

however, this gives me error 4 , extended@:  -2147352567

How can i fix this or find out how to debug this error?

 

Thanks

Link to comment
Share on other sites

This is 0x80020009 - a general exception. Can you please make sure that $NewStartCell holds a correct numeric value and then try the stripped down function call?

_Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, default, "B" & $NewStartCell)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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...