LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default emailing attaching active workbook to it to myself

Hi

I have this problem I am trying to get users to click on a
button and send it to me.

Sub email()
' ChDir "C:\My Documents"
' ActiveWorkbook.SaveAs FileName:= _
' "C:\My Documents\stats9.xls"

'x = MsgBox("Your Stats 9 has now been saved to c:/My
documents and is about to email it to Alistair Straight
away. Would you like this to continue to email Alistair or
email him later.", vbYesNo)

'If x = vbYes Then
ActiveWorkbook.Save

Beep
Beep

Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim newm As Outlook.MailItem
Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
Set newm = ol.CreateItem(olMailItem)
With newm
.To = "bob the builder" ' email address to send to
.Subject = "material" ' subject of the email
.Body = "Hello" ' message in the email
With .Attachments ' attachment
.Add ("ActiveWorkbook") ' add the file i am
using at present
.DisplayName = "boo!!"
End With
.Send
End With
Set ol = Nothing
Set ns = Nothing
Set newm = Nothing

End sub

when i run this all i get is a Run-time error '-1006174187
(c4070015)': device is not ready.

error message and then goes to the part in the macro that
says .add ("activeworkbook") part. what I am trying to do
is save this file onto the users machine but i have no
idea where they are going to put it so i stated a location
but ultimately i work liek to send the activework book
with all the information back to me.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
emailing active sheet with macro BIGBOY1974AA Excel Worksheet Functions 2 July 18th 08 08:23 AM
Attaching only a worksheet but not the whole workbook Jackie at MCard Excel Discussion (Misc queries) 1 January 7th 08 08:33 PM
Attaching a toolbar to a workbook Prixton Excel Discussion (Misc queries) 1 February 24th 07 01:44 PM
Attaching to an email corrupts workbook edger Excel Discussion (Misc queries) 1 February 10th 06 10:36 PM
Sending email WITHOUT attaching a workbook? Kobayashi[_5_] Excel Programming 2 September 25th 03 02:20 PM


All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"