• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Run a Macro in MS Excel (v.X)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Run a Macro in MS Excel (v.X)
      • From: Steve Savery <email@hidden>
References: 
 >Re: Run a Macro in MS Excel (v.X) (From: Steve Savery <email@hidden>)

  • Prev by Date: Re: Very strange dates - BUG
  • Next by Date: Riddle me this
  • Previous by thread: Re: Run a Macro in MS Excel (v.X)
  • Next by thread: Re: Run a Macro in MS Excel (v.X)
  • Index(es):
    • Date
    • Thread