Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default setting address in "mail as attachment" macro

I'm trying to write a simple macro that will email a completed Excel-based
form to a designated email address. The macro as it sits so far -

Sub MailFile()
'
' MailFile Macro
'
Application.Dialogs(xlDialogSendMail).Show
End Sub

opens the mail form with the file attached just fine, but does not input the
designated email address. Can someone help me fill in the blank, as it were.
Thanks!

Alan D.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default setting address in "mail as attachment" macro

Alan;
I use a piece of code to get out batch e-mails. Although mine com
from a database, this might give you a hint.

Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Dim adrToAddress As String

adrToAddress = recSelectL![C_EMAIL]
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.To = adrToAddress 'recipient's address
.Subject = strSubject & " enter a subject." 'subject goes here
.Body = "body of message" ' message goes here
'.Attachment = "c:\path\file.txt" ' attach any files here
'Debug.Print adrToAddress
.Send
End With
End If

JDahlgra

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default setting address in "mail as attachment" macro

When I try to substitute your code for my existing line (substituting an
email address for the "reSelectL![C_EMAIL]" text), I get a "user-defined
type not defined error on the "Dim objOutlook As Outlook.Application" line.
I'm a VB newbie, so I don't have a clue what this is telling me. Any help?

Alan D.


"JDahlgran " wrote in message
...
Alan;
I use a piece of code to get out batch e-mails. Although mine come
from a database, this might give you a hint.

Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Dim adrToAddress As String

adrToAddress = recSelectL![C_EMAIL]
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
To = adrToAddress 'recipient's address
Subject = strSubject & " enter a subject." 'subject goes here
Body = "body of message" ' message goes here
'.Attachment = "c:\path\file.txt" ' attach any files here
'Debug.Print adrToAddress
Send
End With
End If

JDahlgran


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default setting address in "mail as attachment" macro

hi
set a reference to
Microsoft Outlook Library XX
by tools - references..
should work fine

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default setting address in "mail as attachment" macro

I'm afraid I'm not clear on these instructions. I don't find a
"Tools=References" path in either Excel (2000) or Outlook. Also, as my
intention is to also allow access to this form over the internet, I'm
wondering if defining the mail client application as Outlook might be a
litttle restrictive. Is there any other way to generate a more generic
email, like with a mailto hyperlink, with the Excel form - in whatever it's
current state of completion - attached? Thanks.

Alan D.

------
"kedarkulkarni " wrote in
message ...
hi
set a reference to
Microsoft Outlook Library XX
by tools - references..
should work fine,


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default setting address in "mail as attachment" macro

P.S. I did just check out the recent thread with the macro suggestion by
Ron de Bruin, which is pretty close to what I'm going for, except that I
would like to have the email window remain open (so that the subject field
can be modified) instead of having it shot out directly.

------
"Alan D." wrote in message
...
I'm afraid I'm not clear on these instructions. I don't find a
"Tools=References" path in either Excel (2000) or Outlook. Also, as my
intention is to also allow access to this form over the internet, I'm
wondering if defining the mail client application as Outlook might be a
litttle restrictive. Is there any other way to generate a more generic
email, like with a mailto hyperlink, with the Excel form - in whatever

it's
current state of completion - attached? Thanks.

Alan D.

------
"kedarkulkarni " wrote in
message ...
hi
set a reference to
Microsoft Outlook Library XX
by tools - references..
should work fine,


---
Message posted from http://www.ExcelForum.com/





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
Excel hangs after using "Send to mail recipient (as attachment) " Rob Excel Discussion (Misc queries) 1 November 11th 09 10:16 PM
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),QuoteNotes, sarah Excel Worksheet Functions 2 February 17th 09 02:59 PM
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),Range ... ? sarah Excel Worksheet Functions 0 February 17th 09 02:06 PM
Default format for "mail recipient as attachment" emails Pete at Sappi Fine Paper Excel Discussion (Misc queries) 0 July 25th 07 03:58 PM
Excel: "De-activating" an e-mail address cell? HowdyPete Excel Discussion (Misc queries) 2 August 17th 06 04:18 PM


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

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"