Hello,
I'm new to Mac Office.
In Windows Office I used VBA and linked system DLLs to do API calls. How should I do this in Mac Office? Are there any resources on the web that teaches people how to do that?
Thanks~
Kei
Hello,
I'm new to Mac Office.
In Windows Office I used VBA and linked system DLLs to do API calls. How should I do this in Mac Office? Are there any resources on the web that teaches people how to do that?
Thanks~
Kei
Welcome to the VBAX Zone, Mac-style!
I think AppleScript is the way to do it (perhaps also Perl and Python - both available in OS X). However, I have not moved in that direction. I will look for resources for you.
Also, maybe BlueCactus has some ideas.
Software: LibreOffice 3.3 on Mac OS X 10.6.5
(retired Excel 2003 user, 3.28.2008 )
Humanware: Older than dirt
--------------------
old, slow, and confused
but at least I'm inconsistent!
Rich
Hi kei,
I'm not aware of any exact equivalents. But like shades says, you can access AppleScript through Office. This may or may not get you what you need, but will allow you to access Finder, other applications whether they are open or not.
You can run an AppleScript from VBA using
[vba]result = MacScript(script as string)[/vba]
where script can be either a script name (allegedly as I have not tried it), or the script itself contained in a string. Multiline scripts are put together using carriage returns, i.e.
[vba]script = "line 1" & Chr(13) & "line 2"[/vba]
Also, you can run Office or Office VBA from AppleScript, so it goes both ways.
If you've never looked at AppleScript, fish around in the Applications/AppleScript folder. If you open the Script Editor and select Open Dictionary from the menus, you can get a quick idea of what can be accessed, whether it's the Finder, Word, Safari, iTunes or whatever. Also, if you have a recent OS X install disk, I think there might be additional stuff buried in the developer tools. Happy hunting!
So, y'all are the 3 mac users, then? (hee hee...)
~Anne Troy
Thousand against three!
Toughest three we ever met!
Software: LibreOffice 3.3 on Mac OS X 10.6.5
(retired Excel 2003 user, 3.28.2008 )
Humanware: Older than dirt
--------------------
old, slow, and confused
but at least I'm inconsistent!
Rich
Cheek. I am NUMBER FOUR, I will have you know! (I'd rather be Number Six, but that's a different story.)Originally Posted by Dreamboat
kei,
If you look at the Excel VBA Help pages, there are occasional vague references to being able to call 'Mac code resources'. See, for example, the blurb on the Declare statement. What it all means is anyone's guess.
kei,
In case you haven't already found it, the bridge between VB and the Cocoa frameworks is via CamelBones in Perl. CamelBones is an Objective C bridge between Perl and Cocoa. I agree with shades and BlueCamel in starting with Applescript. Depending upon what you are trying to do, Applescript may suffice. If you need full assess to Cocoa, then CamelBones, via Perl, is the way to go.
I've called my Perl routines via Applescript from VB just fine. There is overhead involved, but it does give you access to the full scope of Perl/Cocoa and OSX from within Office.
You can check out CamelBones at Sourceforge:
http://camelbones.sourceforge.net/index.html
Ed