VBA From PC To Mac Without ActiveX

tlaltmey

New Member
Joined
Nov 10, 2021
Messages
20
Office Version
  1. 365
  2. 2019
Hello,

When the following macro is ran after being sent from Windows to Mac OS, we receive "Run-Time Error '429': ActiveX Component can't create object".

From my understanding, this is due to ActiveX not being support on Mac. Is there a way to alter the following code to work on mac?

VBA Code:
Sub Button_Check()

    Application.DisplayAlerts = False
   
    Dim path As String
    Dim filename1 As String
    Dim emailApplication As Object
    Dim emailItem As Object
    Dim x As String

    ApprRejQues = MsgBox("Change to Approved?", vbYesNo, "Select Option")
   
               If ApprRejQues = vbYes Then
                Range("F39").Value = "APPROVED " & Format(Now(), "yyyy-MM-dd hh:mm:ss")
              
                ChDrive "F"
                ChDir "F:\path"
                filename1 = Range("N2") & Range("N3").Value
                ActiveWorkbook.SaveAs Filename:=path & filename1, FileFormat:=52
   
                ActiveWorkbook.SaveAs Filename:=filename1 & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
   
   
                Set emailApplication = CreateObject("Outlook.Application")
                Set emailItem = emailApplication.CreateItem(0)
                   
                emailItem.to = "email"
                emailItem.Subject = "Approval Requested"

                emailItem.Body = "Document has been submitted and requires your attention for Approval."
                emailItem.Attachments.Add ActiveWorkbook.FullName

                emailItem.Send
                   
                Set emailItem = Nothing
                Set emailApplication = Nothing
                   
                Application.DisplayAlerts = True
                ActiveWorkbook.Close
               
               Else
                Range("F39").Value = "REJECTED " & Format(Now(), "yyyy-MM-dd hh:mm:ss")
               
                x = InputBox("Reason for Rejection", "Data Entry Form")

                With ActiveSheet
                    .Range("A44").Value = x
                End With
       
               
                'ChDrive "F"
                'ChDir "F:\path"
                'filename1 = Range("N2") & Range("N3").Value
                'ActiveWorkbook.SaveAs Filename:=path & filename1, FileFormat:=52
   
                'ActiveWorkbook.SaveAs Filename:=filename1 & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled

                Set emailApplication = CreateObject("Outlook.Application")
                Set emailItem = emailApplication.CreateItem(0)
               
                emailItem.to = Range("C7").Value
                emailItem.cc = "email"
               
                emailItem.Subject = "Rejected"

                emailItem.HTMLBody = "The attached document has been REJECTED for the following reason:" & "<br>" & "<br>" & x & "<br>" & "<br>" & "Please review as to why this document was rejected and communicate with the originator of the document as to whether additional changes should be made and resent for approval."

                emailItem.Attachments.Add ActiveWorkbook.FullName

                emailItem.Send
                   
                Set emailItem = Nothing
                Set emailApplication = Nothing
                   
                Application.DisplayAlerts = True
                ActiveWorkbook.Close
               
               End If
End Sub
 
Last edited by a moderator:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
1. Where does the error occur.

2. You will have lots of problems trying to automate one Office program (Outlook) from another (Excel) on the Mac.
 
Upvote 0
Microsoft Outlook for Mac is programmable via AppleScript, JavaScript and Objective-C.

You can run an AppleScript within Visual Basic for Applications. You build your Outlook routine in AppleScript, then run it in VBA.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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