Attach Worksheet To Email
Jun 18, 2007
I have been trying to find a method to attach a worksheet to an email WITHOUT sending it. I want my user to be able to create the attachment file and then add some text before sending.
also, I have been playing around with Ron Debruin's code to send one worksheet, found at [url] this is the closest i have found to what I need. except it sends the mail for you. and I can't get it to copy and paste as values only one cell on the worksheet (not the entire worksheet as values).
here is his code
Sub Mail_ActiveSheet()
'Working in 97-2007
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim Sourcewb As Workbook
Dim Destwb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim AddresseeName As String
View 9 Replies
ADVERTISEMENT
Dec 29, 2011
I have this Macro working almost perfectly, but I need to attach the worksheets to the emails. The code is below. I am unable to reference the ".Attachments" to the workbook created previously in the code.
Sub ActivityReport()
' Clear out any old data on Report
Sheets("Report").Select
[Code].....
View 1 Replies
View Related
Jun 10, 2014
I'm generating a letter (Word doc) and populating bookmarks with data on a worksheet using the following code which is assigned to a Button and it works a dream (in terms of opening the Doc and populating the bookmarks with whatever data is in the relevant cells on the worksheet):
Sub test()
Dim objWord As Object
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open "location of the letter.doc"
[code]......
However, what I now need to do is Create an Outlook Item (email) with a Standard Subject and send to an email address that will be on the same worksheet (in cell M2 for instance) and with a standard Body.
I dont really need to open the Word doc, like it does at present, but I do need the Bookmarks contained within it to be populated with the source data contained within the Worksheet and subsequently have it attached to the email fully populated - maybe I need to 'close' / 'save as & close' the Doc post generation?
View 6 Replies
View Related
Sep 19, 2013
show me the visual basic codes that allow me to attach the current saved workbook to an email (just attach, but not to send the file). So basically, just open the Outlook, send to, and attach the file.
View 6 Replies
View Related
Feb 10, 2009
I wrote this code years ago to Auto Send Emails from Outlook...
Sub Emailfile()
Dim OutlookApp As Object
Const olMailItem = 0
Set OutlookApp = CreateObject("Outlook.Application")
Dim EmailContent As String
With OutlookApp.CreateItem(olMailItem)
EmailContent = Range("A1").Value
.To = "Test"
.Subject = "LSG Data File"
.Body = EmailContent
.Attachments.Add ("P:MI TeamICCE LEADS EXTRACTSLSGLSG Data File")
End With
End Sub
I can't figure out how to get it working for Lotus notes... So 2 things I guess really... Firstly is it possible? Second: If it is, how can I get it to send say 16 emails each with a specific attachment but the same commentary?
View 9 Replies
View Related
Jul 31, 2014
I'm currently creating E-mails containing a table of material numbers in the body of the message. The E-mail is generated with a macro from a table in excel. In some folder - say on the desktop - I have PDF files for each material Number. Each file is called 0012345_Product-Name.pdf where 0012345 is the material number (always 7 digits). I want the macro to look for the pdf for each material number found in the table and add it to the E-mail as an attachment. With constant, known file names this wouldn't be much of an issue. However, I'm having trouble getting the macro to only search for the first 7 digits of the filename and select it based on that.
Since we are talking up to several 100 PDF's, it would also be great to zip them, once selected - if at all possible, before attaching them to the E-mail
View 2 Replies
View Related
Apr 8, 2008
I have developed a product that's a bunch of Excel spreadsheets strung together. Real estate and mortgage professionals use the tools to counsel home buyers. We include a pdf converter in case recipients of emailed file attachments don't have Excel.
We provide an 'Export' procedure that calls a custom dll that uses the outgoing mail server that the user [must] setup or our web's mail server as a default. The action attaches the Excel or the PDF file and sends in the background. We use an Excel form for user to write the message and the process saves a copy of the message sent and the file send in an Archives folder.
This procedure is not very user friendly, as it does not offer the user's address book to select a recipient, does not put the message in the user's email client Sent folder...Plus the Archives folder could become quite large...plus it involves a user setup that creates alot of support calls.
But actually the most critical shortcoming has become that ISPs (Comcast and ATT so far) are blocking the use of custom email clients!
Recently my son showed me in QuickBooks their attach file-to-email process. It simply opens the user's default email client with the file attached. I need an app that does that! And it needs to be distributable.
View 9 Replies
View Related
Nov 21, 2013
I have written a macro but unable to make it work. The macro works but not the way I would like it to.
The macro has to save an excel sheet to a separate folder as a pdf format, a message box should pop up confirming the pdf file and then attach the same saved pdf file to an email.
Now the macro saves the pdf file where I need it to be saved, the msg box pop up and then the pdf file opens up on top of the msg box. If I close the pdf file the msg box which was hidden under the file is now shown. When I click "OK" it goes straight to outlook with the email addresses attached but the saved pdf file is not attached.
I've attached the script.
Sub Macro1()
'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:UserReportsPDF Reports" & Range("Q3").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
[Code] ........
View 8 Replies
View Related
Jan 30, 2012
I am looking for a macro that will convert the active sheet in an Excel 2010 file to a PDF, attach the PDF to an Outlook 2010 email message, and fill in the subject line and recipient address which are the same each time.
View 3 Replies
View Related
Feb 7, 2014
I have two pieces of code that each work, but I am struggling to combine the two.
I started with Ron de Bruin's code to attach multiple files to an email and then found more code that will loop through a folder to attach multiple files to an email.
Essentially, I would like the structure of Ron de Bruin's code, with the ability to have folder paths in the cell range, rather than file names.
Here is the code that works to loop through a folder, but it only works when I have the paths listed in one column, not in a range (e.g. columns C-Z)
Code:
Sub Send_Indv_Files()
Dim OutApp As Object
Dim OutMail As Object
[Code].....
View 4 Replies
View Related
Apr 22, 2013
I am using a version of the following code that sends a mail using Lotus notes and attaches the Workbook - I am wondering if there is anyway I can make it attach the WORKSHEET instead ?
Code:
'The procedure for executing the main task:
Sub SendWithLotus()
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant
[code]...
View 1 Replies
View Related
Mar 2, 2009
I currently have a button then when pressed automatically sends a summary report taken from the first page of Sheet 1.
Worksheet needs to be protected all the time, but Macro only works on an unprotected worksheet.
I was wondering what additional code and where to put in so that when
protected back again after Macro has been executed?
Here’s the Macro taken from [url]
View 11 Replies
View Related
Oct 26, 2009
So I want to be able to send out a meial of a copy of a wrok sheet from Excel. I wan to be able to send out and orginal (Insert Referral) and then a modified version (out). I got the code working for the out version but when I copy the code and change the names it does not insert the email addresses in the TO: address bar in outlook. the VBA cose is pulling the email adress off of a worksheet depending on who I want each task to goto. I just can not figure out why my second code is not working. Here is the working first code
View 8 Replies
View Related
Jan 5, 2007
I would like to copy and paste special (values) and give the tab a name (e.g,. “Proposal”) where I’m using the activesheet.copy and then send as an email attachment…?
Sheets("proposal").Select
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SendMail myemailto, "testEmailAttachment " & Format( Date, "dd/mmm/yy")
.Close False
End With
View 3 Replies
View Related
Jun 26, 2014
I have the following code in VB from somewhere. How to modify or adding from the following codes.
(1) Is anyway I can modify sedning out PDF instead of the actual workbook?
(2) Is anyway I just want the range from (A1:G80) instead of the whole sheet for printing (PDF).
View 3 Replies
View Related
Nov 9, 2008
I currently have a workbook that copies the first sheet and emails it to an individual on the first day of the week.
New requirements are for it to be sent to a list of people.
I am at an impasse on how to proceed due to lack of knowledge. The current code obtains the recipient from Sheet3 D4 and i would like to be able to list down this column for additional emails without restricting this to a set number of cells.
I have searched the forum and have been unable to find what i am after.
I have included a test file to show what i have so far.
We use Outlook 2k3
We use Excel 2k3
View 12 Replies
View Related
Nov 6, 2009
I have a spreadsheet that I send emails from. Currently I use the .PrintOut command just before .send and it prints the email to the default printer. Instead of printing to the printer i want to print the email to pdf or any file for archive purposes. I would also like the file to be located on a network drive with a file name from a cell in the spreadsheet with todays date. Is this possible?
Currently the code looks like this:
VB:
With OutMail
.to = sh.Range("A1").Value [code]....
View 9 Replies
View Related
Feb 14, 2013
I need to know how to send an excel worksheet as an xls attachment by email.
View 2 Replies
View Related
Jan 27, 2009
I need a code to be applied to a VB button that will email out a selected worksheet within the workbook, lets say i need to email out sheet5. Is it possible when the button is clicked to bring up my email client, (it's not Outlook) with the file already attached so i just need to add the email address/adresses?
View 9 Replies
View Related
Aug 14, 2012
I am trying to automate a process whereby i receive an email via outlook with a particular subject line every day and i want to copy the body of the email into an existing excel spreadsheet and save it.
It's the first time i've really used vba in outlook, and i have written one to save any attachments which works ok using rules/run a script, but i'm stuck when it comes to copying the body
It would be really useful if when pasting into excel it didn't go all into one cell and just pasted over like if you were performing it manually
View 1 Replies
View Related
Mar 4, 2014
I have been trying to write a couple of macros;
1) save file as pdf, to be saved as filename=(cell in A1 & todays date (format yyyy-mm-dd)) and overwrite any existing file of the same name.
2) Email the pdf to a set of recipients round in Range "A2:A3", and subject = (cell in A1 & todays date (format yyyy-mm-dd))
View 5 Replies
View Related
Jan 28, 2009
I have a VB code that pulls up my Email client and emails out the workbook as an attachment. I would like to change the code so that it just emails out the worksheet i am currently on and not the whole workbook. Can this be done? I have added the code.
Option Explicit ...
View 9 Replies
View Related
Nov 6, 2009
I have a spreadsheet that I send emails from. Currently I use the .PrintOut command just before .send and it prints the email to the default printer. Instead of printing to the printer i want to print the email to pdf or any file for archive purposes. I would also like the file to be located on a network drive with a file name from a cell in the spreadsheet with todays date. Is this possible?
With OutMail
.to = sh.Range("A1").Value
.CC = ""
.BCC = ""
.Subject = sh.Range("H1").Value & " " & sarBody
.HTMLBody = strbody & "<br><br>" & "<H3><B>Specific Notes, If any...</B></H3>" & vbCrLf & varBody & Signature
.PrintOut
.send
End With
View 9 Replies
View Related
Aug 14, 2014
I have the following:
[C1] My dynamic email subject
[C5:C10] My dynamic email body message
My recipient is always same "burak@burak.com"
Now, I need a VBA code, that will automatically open a blank new outlook email window fill the fixed recepient fill the dynamic subject and body of the message from a range in my workbook.
Then just stop there so that I can attach some different files each time and send myself.
View 5 Replies
View Related
Oct 16, 2007
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Count > 1 Then Exit Sub
If Target.Column = 1 Then
If Target = "" Then
Cells(Target.Row, 3).ClearContents
Else: If Target.Value = "test" Then Cells(Target.Row, 3) = my.Email.co.uk
End If
End If
Application.EnableEvents = True
End Sub
Basically, my target column is column A, i have 200 employee numbers, now we have to find the email addresses manually which is useless so i want to spend the time writing some code like:
If the target column is 123456 then the offset column D is email address
If the target column is 654321 then the offset column D value is email address.
I have 200 statements like this ill need to add unless anyone has any suggestions, perhaps select case structure?? I dont really know where to start an so i await your replies.
View 9 Replies
View Related
Mar 2, 2009
putting a macro button on an individual worksheet so the user can click a big easy button and a new email will pop up in Lotus notes with the worksheet attached for them to input the address and then send the worksheet..
I prefer to:
Send individual worksheets only
The ability to input the email address is the new composition email in LOTUS Notes
View 9 Replies
View Related
Jun 20, 2014
I need VBA code to automatically send an email notification when data is added to worksheet. I am not very familiar with writing code and have been using other code from other posts. Ideally I would like it to send an email notification with the added information attached, in this case it would be Row # and Columns A thru O.
View 1 Replies
View Related
Oct 25, 2012
I have the need to email the current worksheet in Excel 2007, which I have been able to do with the following ...
Sub SendTab()
'Declare and initialize your variables, and turn off screen updating.
Dim wks As Worksheet
Application.ScreenUpdating = False
Set wks = ActiveSheet
[Code] .......
Is there a way I can also get it to also rename the sheet from the default "Book1" to the information in a referenced cell.
View 7 Replies
View Related
Apr 1, 2013
I am trying to attach a counter to a variable. I am trying to attach the counter "k" to the variable "A", instead of separately writing code for A1, A2, A3, and A4. Each variable corresponds to the same worksheet function calculation (such as average in this case), but refers to a different set of data. So, if I run the following code, it does not work. I know how to do it using an array.
VB:
Option Explicit
Dim A1 As Double, A2 As Double, A3 As Double, A4 As Double
Dim k As Integer
[Code] ....
I have attached the excel file : Book1.xlsm
View 7 Replies
View Related
Sep 22, 2013
I have found no option here to attache file (excel, or word if any). How to attach file in to create a new thread ?
View 1 Replies
View Related