Jump to content

Running Excel Macro with args


Recommended Posts

I can call and execute regular macros inExcel from autoIt. I have that needs to be passed a parameter and it would appear that my syntax is not correct. Code Follows:

Func runMacros() ;Runs the Macros in the Excel Workbook

With $ExcelWorkbook

.Application.Run ("StartUp")

.Application.Run ("TrainerYear")

.Application.Run ("FilterToCrit "&$rowPg2 )

EndWith

EndFunc

The first two macros run just fine. I'm trying to pass the parameter on the third and it continues to fail.

Any Ideas?

Thanks

Ray

Link to post
Share on other sites

I can call and execute regular macros inExcel from autoIt. I have that needs to be passed a parameter and it would appear that my syntax is not correct. Code Follows:

Func runMacros() ;Runs the Macros in the Excel Workbook

With $ExcelWorkbook

.Application.Run ("StartUp")

.Application.Run ("TrainerYear")

.Application.Run ("FilterToCrit "&$rowPg2 )

EndWith

EndFunc

The first two macros run just fine. I'm trying to pass the parameter on the third and it continues to fail.

Any Ideas?

Thanks

Ray

Try this:

.Application.Run ("FilterToCrit ", $rowPg2)

You can include up to something like 20 parameters thus:

.Application.Run("Macro", $param1, $param2, $param3, ...)

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to post
Share on other sites

Try this:

.Application.Run ("FilterToCrit ", $rowPg2)

You can include up to something like 20 parameters thus:

.Application.Run("Macro", $param1, $param2, $param3, ...)

-S

Thanks Locodarwin

Your suggestion did the trick. I thought I had already tried that syntax but I guess not.

Thanks Again

Ray

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...