PDA

View Full Version : mail a workbook



lior03
10-14-2007, 11:29 AM
hello
this is johnske's send a workbook macro.i want to add a new feature through a msgbox.the size in bytes of the workbook and wheter it is to big to be sent in one piece.namely does it exceed the allow size by the email software.

Sub EmailDialog()
' 'Send workbook as attachment
' '//Show the dialog, insert recipients and subject\\
Application.Dialogs(xlDialogSendMail).Show _
"aaa@bbb.com; xxx@yyy.com;", _
"Subject", True '< True = download messages
End Subthanks

Oorang
10-14-2007, 02:29 PM
Option Explicit
Sub EmailDialog()
' 'Send workbook as attachment
' '//Show the dialog, insert recipients and subject\\
Const lngMaxBytes_c As Long = "5242880" '(5MB)
ActiveWorkbook.Save
If VBA.FileLen(ActiveWorkbook.FullName) > lngMaxBytes_c Then
If _
MsgBox("This file is larger than is preferred. Do you wish to send anyway?", _
vbYesNo Or vbQuestion Or vbSystemModal Or vbDefaultButton1, _
"Caution") = vbNo Then
Exit Sub
End If
End If
Application.Dialogs(xlDialogSendMail).Show _
"aaa@bbb.com; xxx@yyy.com;", "Subject", True '< True = download _
messages
End Sub

lior03
11-01-2007, 12:50 AM
hello
this is johnske's macro.it allow a user to send activesheet by email.

Sub Mail_ActiveSheet()
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.saveas "Part of " & ThisWorkbook.name _
& " " & strdate & ".xls"
.SendMail "rafi@matnasim.org.il", _
"activesheet excel sent"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub


how can i let the user send the activesheet to several addresses separated by comma.could it be doen through inputbox?
thanks

lenhardt1
11-03-2007, 03:16 PM
hello
this is johnske's send a workbook macro.i want to add a new feature through a msgbox.the size in bytes of the workbook and wheter it is to big to be sent in one piece.namely does it exceed the allow size by the email software.

Sub EmailDialog()
' 'Send workbook as attachment
' '//Show the dialog, insert recipients and subject\\
Application.Dialogs(xlDialogSendMail).Show _
"aaa@bbb.com; xxx@yyy.com;", _
"Subject", True '< True = download messages
End Subthanks
Quick question. How would I insert multiple users? Such as adding people to the TO and CC lines in the email

lenhardt1
11-03-2007, 03:56 PM
question....If I wanted to add a CC line how would I do that? Thanks