Sign in to follow this  
Followers 0
miki

Problem using _XLArrayRead and XLS file

7 posts in this topic

I have written an autoit script and I have a problem with this part of code:

***

#include"ExcelCom.au3"

$FilePath=@ScriptDir&"\kesa.xls"

$z=_XLArrayRead($FilePath,1,"A1:M93",1)

_XLsave($FilePath,1,1)

I can read the Excel cell and store their value on local variable that I use in other part of the script.

But when I change a value of an Excel cell the other cell linked to the previous arent refreshed.

Es. If before

A1=2 , B1=4 C1=A1+B1=6

After I run the script ***

And then I change the value A1 from 2 to 7.

But the C1 cell show always the value 6 instead of the correct value 11.

I can see the value 11 in the C1 cell only when I save the xls file.

Is there a solution on that problem, maybe changing the synthax of the script?

Thanks for any help :P

Share this post


Link to post
Share on other sites



Hi,

re-calculation deliberately is forced only with

1. _XLSave etc, any save.

2. _XLCalc

Turns off calculation to manual, and returns to auto/ manual which was preset if "Save" requested

_XLCalc(ByRef $s_FilePath,$s_i_Visible=0 ,$i_Suppress=0)

So use number 2 if you are not saving.

Best, Randall

Share this post


Link to post
Share on other sites

@ randallc

Thans for the advice.

I have added the line

_XLCalc($FilePath)

and now the script is:

#include"ExcelCom.au3"

;#include"Array2D.au3"

$FilePath=@ScriptDir&"\kesa.xls"

$z=_XLArrayRead($FilePath,1,"A1:M93",1)

_XLCalc($FilePath)

Now the calculation is OK but when the script end, the Excel windows disappear and I don't want it.

What can I do for that?

Share this post


Link to post
Share on other sites

@ randallc

Ok now I have the refresh and the Excel window active.

Thank you very much!

P.S. Excel UDF are very useful great work, you are the :P

Can you tell me where learn about the parameters to pass to " _XL" UDF functions?

Share this post


Link to post
Share on other sites

good,

Sorry it is not brilliantly documented; in the "ExcelCom.au3" file, comments first 50 lines or so?...

Best, Randall

OK thans a lot

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