View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default File Size Matters

Hi AndrewJ

Be sure that the usedrange is correct

Ctrl End will select the last cell
If it is to large the html is also large



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"AndrewJ" wrote in message ...
Hello,

I'm not sure if this is an Outlook issue or an Excel one, but thought
best to start here. I'm using the following code to send an Excel
worksheet via Outlook. The issue I'm having is this...when I send the
e-mail it's about 99kb in size, but when the other users from my team
are sending it out, it can be as big as 546kb. We send this file out
every hour and it's filling up people's inbox. We're using the same
file and same macro to send it....I'm at a loss. Not sure what could
be causing it.

We are using Outlook 2003 and Excel 2003

Private Sub CommandButton1_Click()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set rng = Nothing
Set rng = ActiveSheet.UsedRange

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

On Error Resume Next
With OutMail
.From = ""
.To = ""
.CC = ""
.BCC = ""
.Subject = Format(Date, "mm-dd-yy ") & "9PM "
.HTMLBody = RangetoHTML(rng)
.Display

End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

If anyone has any ideas as to why this would happen I would appreciate
your thoughts.

Thanks,
Andrew