Sign in to follow this  
Followers 0
mary

Please help with Excel Com

5 posts in this topic

#1 ·  Posted (edited)

Hi !

Why my code below gives an error (==> The requested action with this object has failed.: ) only when i click or do any manuel action on the workbook ?

thinks for any help

here juste an exemple to understand what i mean (just run it and tray to click in the opened workbook)

$oExcel = ObjCreate("Excel.Application")
$oExcel.visible =1
$oExcel.workbooks.add


while 1
    

With $oExcel.activesheet
    .cells(1,1).value = @HOUR 
    .cells(1,2).value = @MIN
    .cells(1,3).value = @SEC 
    
Endwith
sleep(250)

WEnd

the error is :==> "The requested action with this object has failed.:"

Edited by mary

Share this post


Link to post
Share on other sites



Works great for me. Do you have the latest AutoIt beta installed and activated? The normal version of AutoIt isn't very good with this sort of thing.


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

Works great for me. Do you have the latest AutoIt beta installed and activated? The normal version of AutoIt isn't very good with this sort of thing.

Yes I have the latest beta but the problem is the same ! Did you try to click in a any cells when my autoit script runs ??

I said: the problem is Only when you click on workbook sheets .

thinks a lot for your help

Share this post


Link to post
Share on other sites

Ah, no I didn't try clicking. Sorry, I should have actually read what you typed. Try this:

$oExcel = ObjCreate("Excel.Application")
$oExcel.visible =1
$oExcel.workbooks.add

$thesheet = $oExcel.activesheet

while 1
    With $thesheet
        .cells(1,1).value = @HOUR
        .cells(1,2).value = @MIN
        .cells(1,3).value = @SEC
    Endwith
    sleep(250)
WEnd


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Actually that doesn't fix it either. Sorry. This kind of aleviates it:

$oExcel = ObjCreate("Excel.Application")
$oMyError = ObjEvent("AutoIt.Error","COMflict")
Func COMflict()
  Consolewrite("COMflict:"&@HOUR&":"&@MIN&":"&@SEC & @CRLF)
Endfunc

$oExcel.visible =1
$oExcel.workbooks.add

$thesheet = $oExcel.activesheet
while 1
    With $thesheet
        .cells(1,1).value = @HOUR
        .cells(1,2).value = @MIN
        .cells(1,3).value = @SEC
    EndWith
    sleep(1000) ;  clocks don't need to be updated more than once per second.
WEnd
Apparently Excel COM is not designed to allow concurrent operations. If you mess around in another cell or sheet while the script is running, the time cells will not update until you finish editing, or finish moving the selection around.

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

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