Jump to content

Problem using _XLArrayRead and XLS file


miki
 Share

Recommended Posts

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

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

Link to comment
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?

Link to comment
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?

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...