• 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
Excel v.x
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Excel v.x


  • Subject: Excel v.x
  • From: "Craig D. Sutherland" <email@hidden>
  • Date: Thu, 29 Nov 2001 21:33:23 -0600

Received the MS Office upgrade and began to explore existing scripts created in Script Debugger 3.0.1-- well actually trued to run a script that called a MS Excel VB macro which had functioned just fine under 10.0.1, AS 1.7f2 and Excel 2001.

The script uses the Excel verb Evaluate to call the VB Macro. In Excel v.x, the Evaluate verb is in the Excel Dictionary and has the same syntax as it did in Excel 2001, but the results are very different. Evaluate does not cause the VB macro to execute as I would expect or as it did in 2001. Instead, it returns a result of "=", and does not execute the instructions within the macro.

Tell application "Microsoft Excel"
activate
evaluate "'Test.xls'!TestMacro()"
end tell

VB

Sub TestMacro()
sheets("sheet2").select
end sub

Also tried "'Test.xls'!TestMacro" (no parens thinking the parens now define a function).

Tried recording a script to duplicate the VB actions and the resulting applescript produced the same, "=" result and did not execute the function in the macro.

I looked at the RealBasic capabilities to see if Evaluate was not the right way to call an OSA event, but did not see any hints. MS is clear in the documentation provided for OSA that VBA code can be copied ot RealBasic. They state that VBA code will run faster. No other documentation can be found by the very surprised and frustrated scripter.

There has to be some basic Homerian "DOH!" that will once again provide a dose of un-appreciated humility.

Ideas?

Craig Sutherland


  • Follow-Ups:
    • Re: Excel v.x
      • From: Rob Jorgensen <email@hidden>
  • Prev by Date: Re: Run Script upon Waking? Solved!
  • Next by Date: Re: Scripting MegaPhone {was Re: not finding "help" helpful}
  • Previous by thread: Re: Dynamic Records?? (couple more wee things)
  • Next by thread: Re: Excel v.x
  • Index(es):
    • Date
    • Thread