Compile Error

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello all,

I get a "Compile Error - Wrong number of arguments or invalid property assignments" every time I try to run my code. I've been changing this little section, and I feel like I must have missed something little that is causing my error.

Code:
Else  Gmail "email@gmail.com", "password", "", _
    "o> " & vbNewLine & Sheets("Print").Range("AH4") & vbNewLine & Sheets("Print").Range("AH5"), _
    vbNewLine & Sheets("Print").Range("AH6") & "  " & Sheets("Print").Range("AI6") & "  " & Sheets("Print").Range("AJ6").Value & "  " & Sheets("Print").Range("AK6") & "  " & Sheets("Print").Range("AL6").Value, _
    vbNewLine & Sheets("Print").Range("AH7") & "  " & Sheets("Print").Range("AI7") & "  " & Sheets("Print").Range("AJ7").Value & "  " & Sheets("Print").Range("AK7") & "  " & Sheets("Print").Range("AL7").Value, _
    sTo, _
    "1@2.3", _
    pdf
End If

Thanks,

Andrew
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Is Gmail a function/sub?

If it is then the multiple arguments being passed to it should be enclosed in ().
 
Upvote 0
Gmail is a function.

When I have the code like this it works:

Code:
Else  Gmail "email@gmail.com", "password", "", _
    "o> " & vbNewLine & Sheets("Print").Range("AH4") & vbNewLine & Sheets("Print").Range("AH5") & vbNewLine & Sheets("Print").Range("AH6") & "  " & Sheets("Print").Range("AI6") & "  " & Sheets("Print").Range("AJ6").Value & "  " & Sheets("Print").Range("AK6") & "  " & Sheets("Print").Range("AL6").Value & vbNewLine & Sheets("Print").Range("AH7") & "  " & Sheets("Print").Range("AI7") & "  " & Sheets("Print").Range("AJ7").Value & "  " & Sheets("Print").Range("AK7") & "  " & Sheets("Print").Range("AL7").Value, _
    sTo, _
    "1@2.3", _
    pdf
End If

So I'm just doing something wrong when I try to put new lines in the vba code so that it's not too long to read.
 
Last edited:
Upvote 0
Can you post the code for Gmail?
 
Upvote 0
Here's what I have and it still doesn't seem to be working:

Code:
Gmail "email@gmail.com", "password", "" _    "o> " & vbNewLine & Sheets("Print").Range("AH4") & vbNewLine & Sheets("Print").Range("AH5") _
& vbNewLine & Sheets("Print").Range("AH6") & "  " & Sheets("Print").Range("AI6") & "  " & Sheets("Print").Range("AJ6").Value & "  " & Sheets("Print").Range("AK6") & "  " & Sheets("Print").Range("AL6").Value, _
& vbNewLine & Sheets("Print").Range("AH7") & "  " & Sheets("Print").Range("AI7") & "  " & Sheets("Print").Range("AJ7").Value & "  " & Sheets("Print").Range("AK7") & "  " & Sheets("Print").Range("AL7").Value, _
    sTo _
    "1@2.3" _
    pdf
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

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