Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Button to Send Email

I want to have the user click the button and send the current workbook
as an attachement to certian users. I can get to bring up Outlook and
have it populate my certain email addresses by using:

....
Set oMailItem = oOutlook.CreateItem(0)
With oMailItem
Set oRecipient =
")
oRecipient.Type = 1
.Subject = "Agent Form Data for " & emailDate
.Body = "This Agent was submitted on: " & emailDate
.Attachments.Add sAttachment
.Display
....

but when using this I've been trying to use
..attachments.add "some local drive file" but can't use activeworkbook
or anything. Any thoughts?

Thanks in Advance

Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default VBA Button to Send Email

..Attachments.Add ThisWorkbook.FullName

should do it.

--
Jim Rech
Excel MVP
"Dave D." wrote in message
om...
|I want to have the user click the button and send the current workbook
| as an attachement to certian users. I can get to bring up Outlook and
| have it populate my certain email addresses by using:
|
| ...
| Set oMailItem = oOutlook.CreateItem(0)
| With oMailItem
| Set oRecipient =
| ")
| oRecipient.Type = 1
| .Subject = "Agent Form Data for " & emailDate
| .Body = "This Agent was submitted on: " & emailDate
| .Attachments.Add sAttachment
| .Display
| ...
|
| but when using this I've been trying to use
| .attachments.add "some local drive file" but can't use activeworkbook
| or anything. Any thoughts?
|
| Thanks in Advance
|
| Dave


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Button to Send Email

Hi Jim -

That code works great, it attaches the file, but the
saved version. I have people filling out information,
then I want them to click the button send the information
they typed in. Basically do the exact same thing as if
they went up to File--Send--File as Attachment I have
menu's locked and such as thats why the users can't just
do that instead of clicking on my email button.

Thanks Jim in Advance

Dave D.
-----Original Message-----
..Attachments.Add ThisWorkbook.FullName

should do it.

--
Jim Rech
Excel MVP
"Dave D." wrote in message
. com...
|I want to have the user click the button and send the

current workbook
| as an attachement to certian users. I can get to bring

up Outlook and
| have it populate my certain email addresses by using:
|
| ...
| Set oMailItem = oOutlook.CreateItem(0)
| With oMailItem
| Set oRecipient =
| ")
| oRecipient.Type = 1
| .Subject = "Agent Form Data for " &

emailDate
| .Body = "This Agent was submitted on: " &

emailDate
| .Attachments.Add sAttachment
| .Display
| ...
|
| but when using this I've been trying to use
| .attachments.add "some local drive file" but can't use

activeworkbook
| or anything. Any thoughts?
|
| Thanks in Advance
|
| Dave


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default VBA Button to Send Email

I guess you're going to have to force a save if needed before you attach the
file:

If Not ThisWorkbook.Saved Then ThisWorkbook.Save

--
Jim Rech
Excel MVP
"Dave D." wrote in message
...
| Hi Jim -
|
| That code works great, it attaches the file, but the
| saved version. I have people filling out information,
| then I want them to click the button send the information
| they typed in. Basically do the exact same thing as if
| they went up to File--Send--File as Attachment I have
| menu's locked and such as thats why the users can't just
| do that instead of clicking on my email button.
|
| Thanks Jim in Advance
|
| Dave D.
| -----Original Message-----
| ..Attachments.Add ThisWorkbook.FullName
|
| should do it.
|
| --
| Jim Rech
| Excel MVP
| "Dave D." wrote in message
| . com...
| |I want to have the user click the button and send the
| current workbook
| | as an attachement to certian users. I can get to bring
| up Outlook and
| | have it populate my certain email addresses by using:
| |
| | ...
| | Set oMailItem = oOutlook.CreateItem(0)
| | With oMailItem
| | Set oRecipient =
| | ")
| | oRecipient.Type = 1
| | .Subject = "Agent Form Data for " &
| emailDate
| | .Body = "This Agent was submitted on: " &
| emailDate
| | .Attachments.Add sAttachment
| | .Display
| | ...
| |
| | but when using this I've been trying to use
| | .attachments.add "some local drive file" but can't use
| activeworkbook
| | or anything. Any thoughts?
| |
| | Thanks in Advance
| |
| | Dave
|
|
| .
|


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA Button to Send Email

If you use SendMail code it will do what you want
http://www.rondebruin.nl/sendmail.htm#Workbook

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Dave D." wrote in message ...
Hi Jim -

That code works great, it attaches the file, but the
saved version. I have people filling out information,
then I want them to click the button send the information
they typed in. Basically do the exact same thing as if
they went up to File--Send--File as Attachment I have
menu's locked and such as thats why the users can't just
do that instead of clicking on my email button.

Thanks Jim in Advance

Dave D.
-----Original Message-----
..Attachments.Add ThisWorkbook.FullName

should do it.

--
Jim Rech
Excel MVP
"Dave D." wrote in message
. com...
|I want to have the user click the button and send the

current workbook
| as an attachement to certian users. I can get to bring

up Outlook and
| have it populate my certain email addresses by using:
|
| ...
| Set oMailItem = oOutlook.CreateItem(0)
| With oMailItem
| Set oRecipient =
| ")
| oRecipient.Type = 1
| .Subject = "Agent Form Data for " &

emailDate
| .Body = "This Agent was submitted on: " &

emailDate
| .Attachments.Add sAttachment
| .Display
| ...
|
| but when using this I've been trying to use
| .attachments.add "some local drive file" but can't use

activeworkbook
| or anything. Any thoughts?
|
| Thanks in Advance
|
| Dave


.



Reply
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
Command Button - Macro to print to pdf, then send pdf to email. Tdahlman Excel Discussion (Misc queries) 2 May 1st 23 11:44 AM
Button to send current excel workbook by email Chris O Excel Discussion (Misc queries) 1 March 23rd 09 10:57 PM
Excel email mode send button?? JerryCic Excel Discussion (Misc queries) 1 August 7th 07 09:25 PM
Can I send a doc to group of email addresses via a macro button? Richard F Excel Discussion (Misc queries) 6 February 5th 07 09:59 AM
cmd button, send form via email andy[_5_] Excel Programming 1 March 6th 04 07:26 AM


All times are GMT +1. The time now is 03:30 AM.

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

About Us

"It's about Microsoft Excel"