Converting PC Macro to work on Macbook

monkeymaster

New Member
Joined
Oct 15, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I have a macro written on my PC that automatically generates emails based on 4 cells (to:, cc:, subject;, and body). However, I am training an employee at work to use the macro, but they have a Macbook.

How can I get this macro to work on Macs? I have zero coding experience and managed to put this together with help from this board.

Sub Mail_Workbooks()

Dim OutApp As Object, OutMail As Object, WS As Worksheet, r As Long





Set OutApp = CreateObject("Outlook.Application")



Set WS = Sheets("MACRO")

On Error Resume Next



For r = 2 To WS.Cells(Rows.Count, "A").End(xlUp).Row



With OutApp.CreateItem(0)

.To = WS.Cells(r, "A").Value

.CC = WS.Cells(r, "B").Value

.Subject = WS.Cells(r, "C").Value

.Body = WS.Cells(r, "D").Value

.Display

End With

DoEvents

Next r



On Error GoTo 0

Set OutApp = Nothing



End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
hi monkeymaster, please use code tags when you post code. That makes it easier to read. Click on the little VBA icon at the top of your post window, and paste the code there.

VBA on MacOS is somewhat different from VBA for Windows. Some items, like ActiveX controls can't be used. Writing files to the drive needs careful thought because MacOS only allows writing to the sandbox. And now you are wanting to convert Outlook VBA to MacOS. First question: Do your Mac users use Outlook, or native mail system? If they use the native mail system, then I don't think you can do it. You will have to use AppleScript, which I have no experience with.

Ron de Bruin does a lot of coding on both platforms, check his website for some information Excel Automation - Ron de Bruin

Also see what is new in Office for MacOS VBA, because it has better support for AppleScript. Office for Mac for Visual Basic for Applications (VBA)

But you will need to get your hands on a Mac to develop and test your code
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top