Sign in to follow this  
Followers 0
ziggy2000

Autoit crash with excel

10 posts in this topic

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

try changing :

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

to

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Strange - that works for me.

Have you lowered your security and macro settings ?

Share this post


Link to post
Share on other sites

Strange - that works for me.

Have you lowered your security and macro settings ?

Yes low protection

:)

Share this post


Link to post
Share on other sites

Sorry if I insist

I'm trying to all but the problem remains

thanks

luca

Share this post


Link to post
Share on other sites

First of all i would remove the sleep and the msgbox functions.

Also change $oExcel.Visible = 0

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0