Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / Excel / June 2005



Tip: Looking for answers? Try searching our database.

Excel Programming Basics?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chris.dufresne@gmail.com - 15 Jun 2005 18:28 GMT
Hi,

I have a VB program I've written on Windows that essentially starts
Excel, then creates various Worksheets and populates them with data,
does some cell formatting, etc. Keep in mind, this is not a Macro that
is launched from within Excel this is a standalone executable. I
recently bought a Mac and I'd like to do the same thing. I've done many
google searches and I've come up empty on the subject.

What I'm looking for is the Library or Framework I need to interact
with Excel through C or C++ or something similar. A small code snippet
illustrating its use, if available, would also be great. Thanks in
advance,

--Chris
Bernard Rey - 15 Jun 2005 20:51 GMT
chris.dufresne@gmail.com a écrit :

> I have a VB program I've written on Windows that essentially starts
> Excel, then creates various Worksheets and populates them with data,
> does some cell formatting, etc. Keep in mind, this is not a Macro that
> is launched from within Excel this is a standalone executable. I
> recently bought a Mac and I'd like to do the same thing. I've done many
> google searches and I've come up empty on the subject.

Try using AppleScript. It's a system wide programming language and you can
very easily write a script launching Excel and lots of other things.

See:
   http://www.macscripter.net/
or:
   http://www.apple.com/applescript/developers/


> What I'm looking for is the Library or Framework I need to interact
> with Excel through C or C++ or something similar. A small code snippet
> illustrating its use, if available, would also be great. Thanks in
> advance,

tell application "Microsoft Excel"
   activate
   select sheet ("Sheet1")
   set value of range "A2" to "Hello!"
end tell

These lines, pasted in the "Script Edito" would do what you can expect...

---------------------------------------------------------
Please reply to the newsgroup, and within the same thread.
Merci de répondre au groupe, et dans l'enfilade.

Signature

Bernard Rey - Toulouse / France
MVP - office:macintosh              http://faq.office.macintosh.free.fr

Jim Gordon MVP - 16 Jun 2005 00:59 GMT
Hi,

Since you are already familiar with visual basic you might be somewhat
comfortable with Excel's built-in visual basic editor. (View > toolbars
> Visual Basic > Visual Basic Editor).

The VB editor on the Mac supports VBA version 5. There's no Active-X and
just about anything that's new in VB version 6 is not supported. The Mac
VB editor is pretty bare-bones but it will get the job done. You might
find using the Object Editor and the VB help system will be quite useful.

You can create compiled code and save it as Excel add-ins. These add-ins
can be treated like executables or they can be put into the add-ins
folder and can launch automatically whenever Excel opens using
Tools>Add-ins>Add.

Once in the VB editor read these help topics:
* Strategies for Developing Cross-Platform Solutions
* Differences between Excel VBA for Windows and Excel VBA for the Macintosh

In addition to using Visual Basic to build applications you can use
AppleScript and REALBasic.

Here's a good resource for you to check out, too:
http://www.mcgimpsey.com/excel/index.html

-Jim

Signature

Jim Gordon
Mac MVP
MVP FAQ
<http://mvp.support.microsoft.com/default.aspx?scid=fh;EN-US;mvpfaqs>

> Hi,
>
[quoted text clipped - 11 lines]
>
> --Chris
chris.dufresne@gmail.com - 22 Jun 2005 21:14 GMT
Thanks, for all your advice. However it seems from what you're saying
that the solution I'm looking for doesn't exist in the form I'm really
looking for it. The data I populate the worksheets with comes from a
database query, which I believe requires Active-X, so Excel's built in
VB editor is out. Also I was hoping I wouldn't have to purchase
anything additional so REALBasic is out. While Apple script would
probably work, I was just hoping I could write something that was a
little more portable.
Paul Berkowitz - 22 Jun 2005 21:40 GMT
On 6/22/05 1:14 PM, in article
1119471272.832435.288280@g14g2000cwa.googlegroups.com,

> Thanks, for all your advice. However it seems from what you're saying
> that the solution I'm looking for doesn't exist in the form I'm really
[quoted text clipped - 4 lines]
> probably work, I was just hoping I could write something that was a
> little more portable.

If AppleScript works, then so will VBA, which is perfectly portable. You
could develop 99% of it as a macro within Excel - probably best to an add-in
in the Office/Startup/Excel folder. Then all you need to do is create a
two-line standalone AppleScript application to launch Excel and call the
macro in the add-in, and another two-line VB standalone to do the same on
Windows. You could also provide a 4-line installer for each platform if you
like.

Signature

Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X  or 2001. It's often impossible to answer your questions
otherwise.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.