Jump to content

Excel Macro with VB


GAM
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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