Macro's not working on Mac - Run-time error '1004'

hsmith15

New Member
Joined
Jan 19, 2018
Messages
8
I built macros to automate a sales reporting process. I am leaving the company and trying to ensure the sales report will be usable after I leave. My boss who will be running the report uses a MacBook Air.

When I run the macro, the first error that comes up says "Print - Error while printing". Once I clear that error, then I get another error "Run-time error '1004': Application-defined or object defined error.

See below for my code. Anyone know what I need to change to get this to work on a Mac? The debugger specifies the ActiveSheet.Export selection on the 4th line/section as the isssue.

__________________________________________________________________________________
Rich (BB code):
Sub ReportSavePDFsendEmail()


Const myPath = "C:\Users\SP3\Dropbox (1 Stone Solutions)\1 Stone Solutions Team Folder\Houston\Jacob Robinson\Sales Report\Past Reports"


.Sheets(4).Name, ThisWorkbook.Sheets(5).Name, ThisWorkbook.Sheets(6).Name)).Select



ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
        FileName:=myPath & Sheets(2).Range("B2") & ".pdf", _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=False


    
    ' selectReport
Sheets("Report").Select
    Range("A1").Select
    
' send as PDF attachment
Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String


    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)




    With OutMail
        .Display
        .To = "name@email.com; name@email.com"
        .CC = ""
        .BCC = ""
        .Subject = Range("B9")
        .Attachments.Add (myPath & Sheets(2).Range("B2") & ".pdf")
        .HTMLBody = "****** style=font-size:11pt;font-family:Calibri>Team,<br>" & _
                    "<br>See attached for this week's sales report.<br>" & _
                    "<br>Let me know if you have any questions or comments.<br>" & _
                    "<br>Thanks,<br>" & _
                    .HTMLBody
        '.Send
    End With


    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing




End Sub
 
Last edited by a moderator:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
mac has a subtle different vba, not everything is equal
 
Upvote 0
there are a number of comparisons online, but no activex, and subtle vba issues
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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