Jump to content

Autoit crash with excel


 Share

Recommended Posts

Hello

This is my script:

$oExcel = ObjCreate("Excel.Application") ; Create an Excel Object

$oExcel.Visible = 1 ; Let Excel show itself

$oExcel.Workbooks.Open("C:\Users\Giovanni\Documents\ilmioprogramma\segnali.xls");Open Workbook"segnali"

$oExcel.Worksheets("riepilogo").select ;Select worksheet"riepilogo"

;start loop

while 1

$nuovo = $oExcel.Worksheets("riepilogo").range("r30").value ;read cell value 1

$vecchio = $oExcel.Worksheets("riepilogo").range("r33").value ;read cell value 2

;case result by the difference of cell value

Select

case $nuovo = 1 And $vecchio = 0

MsgBox(0,"posizione long",$nuovo)

case $nuovo = -1 and $vecchio = 0

MsgBox(0,"posizione short",$nuovo)

case $nuovo = 0 and $vecchio = -1

MsgBox(0,"posizione flat",$nuovo)

case $nuovo = 0 and $vecchio = 1

MsgBox(0,"posizione flat",$nuovo)

case $nuovo = -1 and $vecchio = 1

MsgBox(0,"posizione reverse",$nuovo)

case $nuovo = 1 and $vecchio = -1

MsgBox(0,"posizione reverse",$nuovo)

case $nuovo = $vecchio

MsgBox(0,"in posizione",$nuovo,1)

EndSelect

$oExcel.range("r33").value = $nuovo ;write e cell

Sleep(9000)

WEnd

the script reads the values of cells in an Excel workbook that is updated with data received from a DDE server.

If I leave the excelworkbook maximized the program works well

But if I Minimize it or open other APPLICATIONS autoit crashes.

How can I change the script to make it more stable and allow me to use the computer during its execution?

tks

luca

Link to comment
Share on other sites

To help you we need additional information:

What operating system version do you use?

What Office version do you use?

Do you run 32/64 bit of the OS and/or Office?

Do you get any error messages?

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

To help you we need additional information:

What operating system version do you use?

What Office version do you use?

Do you run 32/64 bit of the OS and/or Office?

Do you get any error messages?

Vista home basic

6.0.6001 service Pack 1 build 6001

office professional edition 2003

No idea about 32/64 bit . where i can find this information?

>Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Giovanni\Documents\ilmioprogramma\programma(excel.application).au3"

C:\Users\Giovanni\Documents\ilmioprogramma\programma(excel.application).au3 (10) : ==> The requested action with this object has failed.:

$nuovo = $oExcel.Worksheets("riepilogo").range("r30").value

$nuovo = $oExcel.Worksheets("riepilogo")^ ERROR

->12:32:40 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 89.177

tks luca

Link to comment
Share on other sites

try changing :

$oExcel.Worksheets("riepilogo").range("r30").value

to

$oExcel.Application.ActiveSheet.Range("r30").value

Same result

C:\Users\Giovanni\Documents\ilmioprogramma\programma(excel.application).au3 (9) : ==> The requested action with this object has failed.:

$nuovo = $oExcel.Application.ActiveSheet.Range("r30").value

$nuovo = $oExcel.Application^ ERROR

->13:05:48 AutoIT3.exe ended.rc:1

tks

luca

Link to comment
Share on other sites

  • 1 month later...

I have the same problem with a similar script when reading an excel value that originates from a DDE or RTD server. AutoIT will crash when the script attempts to read the cell. No problem arises when the cell is not of DDE/RTD origin.

Line 224: (exe file)

Error: The requested action with this object has failed.

In the source code, that line refers to a listbox, so the line doesn't seem to link up.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...