Re: Run a Macro in MS Excel (v.X)
Re: Run a Macro in MS Excel (v.X)
- Subject: Re: Run a Macro in MS Excel (v.X)
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 29 Jan 2003 10:37:12 -0800
On 1/29/03 8:47 AM, "Steve Savery" <email@hidden> wrote:
>
Sorry to seem so dumb... but how can I use this command to run a macro?
>
I tried the test below but it wouldn't even compile.
>
>
Tell App "Excel"
>
Evaluate Macro "Macro1"
>
End Tell
For one thing, you need to get the name of the app correct. You need the
name of the open workbook followed by "!" and the true call to the Macro as
you would do in VBA. In VBA macro names (subs) cannot have spaces, and must
have parentheses.
tell app "Microsoft Excel"
Evaluate "Workbook1!Macro1()"
end tell
You can pass parameters in the parentheses and can even get results back
from functions.
You can include the full path name to the workbook on your disk if you wish,
but you do have to open it first:
set thePath to (path to At Ease documents folder as string) & "More
Tests:Workbook1.xls"
tell application "Microsoft Excel"
Activate
Open thePath
Evaluate (thePath & "!Macro1()")
end tell
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.