automating Excel
Jim Ault
JimAultWins at yahoo.com
Sat Sep 13 03:09:45 EDT 2008
On 9/12/08 9:24 PM, "Mark Wieder" <mwieder at ahsoftware.net> wrote:
> I recorded a VBA macro of the task
> to be accomplished, then copied the macro into a vbs file and fiddled
> with it from there. I suppose I could have created a blank worksheet
> with that single macro and tried to automate running the macro from
> rev, although I don't know what the syntax would be for that.
-----------------------------
Windows
>From Rev you would use VBScript to call the Excel macro. Since I have not
done it this way, Ken should probably chime in with one of his solutions
(my guess at a working vbs handler, not tested, but should work)
Sub runMacro()
Dim xlapp As Object 'Excel.Application
Set xlapp = CreateObject("Excel.Application")
Dim xlbook As Object 'Excel.Workbook
Set xlbook = xlapp.ActiveWorkbook
xlapp.Run "MyMacro"
' Clean up
xlbook.Saved = True
xlapp.Quit
End Sub
----------------------
Mac
>From Rev you would use AppleScript to call the Excel macro.
put quote into q
get "tell application " & q & "Microsoft Excel" & q
get it & " to run VB macro " & q & " Macro1" & q
do it as AppleScript
or
put quote into q
get merge("tell application [[ q]]Microsoft Excel[[q]]")
get merge("[[it]] to run VB macro [[q]]Macro1[[q]]")
do it as AppleScript
Jim Ault
Las Vegas
More information about the use-livecode
mailing list