Hello everyone.
I am getting an error when running the Macro below on a Mac.
Debugger highlights section Set OutApp = CreateObject("Outlook.Application")
Would appreciate some guidance as to what should be done for this Macro to work on a Mac. Thank you.
Complete macro code follows:
![]()
Sub CXR() ActiveSheet.Unprotect Password:="" ' Don't forget to copy the function RangetoHTML in the module. ' Working in Office 2000-2010 Dim rng As Range Dim OutApp As Object Dim OutMail As Object With Application .EnableEvents = False .ScreenUpdating = False End With Set rng = Nothing On Error Resume Next Set rng = ActiveSheet.Range("CXR_Range").SpecialCells(xlCellTypeVisible) On Error GoTo 0 If rng Is Nothing Then MsgBox "The selection is not a range or the sheet is protected" & _ vbNewLine & "please correct and try again.", vbOKOnly Exit Sub End If Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ActiveSheet.Range("B9").Value .Cc = ActiveSheet.Range("B10").Value .BCC = "" .Subject = ActiveSheet.Range("B11").Value .HTMLBody = RangetoHTML(rng) .Display 'or use .Send End With On Error GoTo 0 With Application .EnableEvents = True .ScreenUpdating = True End With Set OutMail = Nothing Set OutApp = Nothing ActiveSheet.Protect Password:="" End Sub
Bookmarks