Running word/vba on a "mac"?

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Running word/vba on a "mac"?

Post by ChrisGreaves »

Just suppose I had a nifty Word2003/VBA application and a buddy who said "Many thanks by the way for the link to your macros. Unfortunately you're using Windows while I use a Mac".
Depending on the specific Apple hardware, O/S, and other known perturbations, what are the chances that my stuff might execute on his machine?.

He is my age, bright, but I suspect, not computer literate.

My VBA code is not designed to do wonderful user-interface things; it uses a Word Document table of rules to drive itself, reads a user's Word document, and analyzes the text content. Being written (originally) in Word 6.0, then migrated to Word 97 and is now Word2003, it does not mess around with The Ribbon. Just sits there and gets the job done with one macro call.

Pages like this, and this, and this encourage me to urge him to try it.

I would like to hear if anyone on this Lounge has taken a Word(2003) macro and managed to run it on a Mac, any Mac, at this stage.
If I hear "yes", then I might suggest that my buddy provide lunch for a buddy of his to sit with him and get it working.

Thanks
Chris
P/S If anyone who has a Mac wants to experiment with the program, they are welcome to have a copy.
C
An expensive day out: Wallet and Grimace

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: Running word/vba on a "mac"?

Post by rory »

I'd say it depends entirely on what the macro does and how it's written. :)

I'm assuming he doesn't have Office 2008. If he does, no VBA will work.
Regards,
Rory

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Running word/vba on a "mac"?

Post by ChrisGreaves »

rory wrote:
04 Feb 2022, 10:30
I'd say it depends entirely on what the macro does and how it's written. :)
Thank you Rory.
Absolutely.
But although it is a complex process, the programming is simple VBA commands. I wrote it in WordBasic back in the days when Word 6.0 had just replaced Word 2.0, and a year later I was dragged kicking and screaming into Word97, and completely rewrote it in VBA then
There are, possibly, some weird little bits, and those will rear their ugly heads the minute he tries to run it. I will take it from there.
But for now, I could send him a dead-simple bit of code, like the application that summarizes my Notepad .LOG files and see if that will Load-And-Run.

At this time I don't want to burden him with a "scary task" unless I know that there is a reasonable chance that we can get it working.
I'm assuming he doesn't have Office 2008. If he does, no VBA will work.
I am puzzled about this.
Is VBA written in Office2008 unrunnable on a Mac?
I'd not heard of Office2008
Thanks, Chris
An expensive day out: Wallet and Grimace

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Running word/vba on a "mac"?

Post by HansV »

Office 2008 was a Mac-only version of Office. For reasons only known to Microsoft, the Mac versions before 2008 and after 2008 had VBA, but 2008 did not.

Notepad is a Windows-specific application, trying to call it from your code will fail on a Mac.
File manipulation code may also fail - for example, a Mac does not have a C: drive, and the path separator is : instead of \
Best wishes,
Hans

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: Running word/vba on a "mac"?

Post by rory »

The separator actually varies between Mac versions, so you really have to use Application.Pathseparator to have any chance...

And Apple's new sandboxing can limit what you have access to, again depending on macos version.

Basically it's a can of worms. ;) And God help you if you need to actually develop on a Mac.
Regards,
Rory

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Running word/vba on a "mac"?

Post by ChrisGreaves »

HansV wrote:
04 Feb 2022, 12:32
Office 2008 was a Mac-only version of Office. For reasons only known to Microsoft, the Mac versions before 2008 and after 2008 had VBA, but 2008 did not.
Thanks Hans, I see. So my communication to my colleague will be "If you are not dependent on Office 2008, then ..."
Notepad is a Windows-specific application, trying to call it from your code will fail on a Mac.
Thanks for this too. The simple Billing program does not invoke Notepad at all. That is done by the shortcut to Notepad on my laptop. That shortcut fires up Notepad, who sees the .LOG, and inserts a timestamp; then I key in project data.

The data file that is processed by my billing application is the TXT file generated by Notepad over the previous month. I would as a matter of principle supply sample TXT files with the package.
File manipulation code may also fail - for example, a Mac does not have a C: drive, and the path separator is : instead of \
Ahhah! So now we are examining Chris's VBA coding standards, eh?
Fair enough; they are wonky at the best of times.
I will start with "MsgBox "Hello World!"" and move on from there.
Cheers
Chris
An expensive day out: Wallet and Grimace

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Running word/vba on a "mac"?

Post by ChrisGreaves »

rory wrote:
04 Feb 2022, 13:03
The separator actually varies between Mac versions, so you really have to use Application.Pathseparator to have any chance...
And Apple's new sandboxing can limit what you have access to, again depending on macos version.
Basically it's a can of worms. ;) And God help you if you need to actually develop on a Mac.
Thank you Rory.
So I think that the answer to my question is "It is worth a try, depending on how much time you and your colleague are prepared to spend on this, which quantity is a function of the value of the program to your colleague".
In other words I am back in the business of writing a proposal, albeit an informal one.

That's one more step forward.
Cheers
Chris
An expensive day out: Wallet and Grimace