Jump to content
Sign in to follow this  
GAM

Excel Macro with VB

Recommended Posts

GAM

HI,

Can any one help me ....My whole idea is to run a excel macro from autoit script, I included excel macro commands into autoit but failing at the LINE 4.

SCRIPT

------------------

With $oExcel

1 WinActivate("C:\Documents and Settings\epo\Desktop\VSE85\test case 1.txt_85_01181107.XLS")

2 .Charts.Add

3 .ActiveChart.ChartType = IsString("xlLineMarkers")

4 .ActiveChart.SetSourceData Source:=Sheets("TC1").Range("A1:D276"), PlotBy:=xlRows

EndWith

----------------

ERROR DISPLAYED IS AS FOLLOWS...

------------------------------------

C:\Documents and Settings\epo\Desktop\Excel_Autoit.au3 (7) : ==> Unable to parse line.:

.ActiveChart.SetSourceData Source:=Sheets("TC1).Range("A1:D276"), PlotBy:=xlRows

.ActiveChart.SetSourceData Source^ ERROR

>Exit code: 1 Time: 0.211

---------------------------------------


Neil

Share this post


Link to post
Share on other sites
GAM

CAn anyone help me answering the above error, as its very important to me in my project.


Neil

Share this post


Link to post
Share on other sites
Kerros

I would check into using an Excel UDF.. there are several excellent ones available. The one I use is ExcelCOM_UDF.au3.


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites
big_daddy

With the little amount of information you have given, this is my best guess.

Const $xlRows = 1
Const $xlLineMarkers = 65

WinActivate("C:\Documents and Settings\epo\Desktop\VSE85\test case 1.txt_85_01181107.XLS")
With $oExcel
    .Charts.Add
    .ActiveChart.ChartType = $xlLineMarkers
    .ActiveChart.SetSourceData(.Sheets("TC1" ).Range("A1:D276"), $xlRows)
EndWith

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.