Ron on email code

J

John

I get an error on the ActiveWorkbook.Sheets("Impulse").Export _
Filename:=Fname, FilterName:="GIF" ... line saying error 438
Sub emailimpulse()
'Working in 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim Fname As String

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

'fill in the file path/name of the gif file
Fname = "C:\My_impulse.gif"

'Save Chart sheet as Gif file
ActiveWorkbook.Sheets("Impulse").Export _
Filename:=Fname, FilterName:="GIF"

On Error Resume Next
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "Impulse" & " " & Format(Now, "mm-dd-yy h:mm:ss")
.Body = ""
.Attachments.Add Fname
.display 'or use .Display
End With
On Error GoTo 0

Kill Fname
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


CAN you help?
 
R

Ron de Bruin

Hi John

I test it on a machine with your Win/Excel version without problems
Do you have another machine to test it on ?
 
J

John

how do I do that? what is your email and this line works... but not the
whole sheet... i may just go with that

ActiveWorkbook.Worksheets("Sheet1").ChartObjects("Chart 1").Chart.Export _
Filename:=Fname, FilterName:="GIF"
 
J

John

well I switched the format of h:mm:ss in the file name and that cause a
problem in another piece of code and may have been the culprit here as well.
I am all set now with what I need, thank you for your help
 
J

John

Well, I can export just a chart, but if I try an export a sheet I cannot do
it. Can I send you my test sheet which doesn't work.. very simple.

whats your email
 
R

Ron de Bruin

Update: John was trying to use export on a normal worksheet instead of a Chart sheet
 

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