Email

C

chrisnsmith

I'm using Ron de Bruin's email code to send my active workbook. I'd like to
be able to send a document saved to my desktop along with this code. Can
anyone tell me what I need to add?

Ron's code:

Sub Mail_workbook_1()
'Working in 97-2007
Dim wb As Workbook
Set wb = ActiveWorkbook

If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will" &
vbNewLine & _
"be no VBA code in the file you send. Save the" &
vbNewLine & _
"file first as xlsm and then try the macro again.",
vbInformation
Exit Sub
End If
End If

On Error Resume Next
wb.SendMail "(e-mail address removed)", _
"This is the Subject line"
On Error GoTo 0
End Sub
 
C

chrisnsmith

I should have mentioned that both workbooks are open at the time I want to
email.
I discovered that if I just reference the workbook name I can send as many
workbooks as I wish with your code as long as they are all open.
Thanks
 
R

Ron de Bruin

Hi chrisnsmith

If you use the Outlook object model code on my site you can send
any file you want but this is not possible with SendMail.
The files not have to be open
 
D

Dar

I'm hoping you're still active, and would like to incorporate your code but
using Lotus Notes instead of outlook. I need to know how to modify code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top