attach excel sheet

G2K

Active Member
Joined
May 29, 2009
Messages
355
Hi All,

i have a macro to attach a excel sheet in new mails in outlook express and i use it to send a feedback form to our clients.at the clinet end, they need to save it on their system, update it and send it back to me.

is there any way to attach the same file without saving it. or what other options i have.....
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
What do you mean?, of course they can forward the mail back to you complete with attachment.

Really what you want to do is have the macro that you have to send mail with attachment in your attached workbook in the thisworkbook module in this event "Private Sub Workbook_BeforeClose(Cancel As Boolean)" so after they have filled the form in and close it sends the workbook to you.
 
Upvote 0
thanks Simon,

but it's not working. below is the code...


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim OutlookApp As Object
Dim MItem As Object
Dim Wb As Workbook
Dim NewWb As Workbook
Dim Ws As Worksheet

'Create Excel sheet link
Set Wb = ActiveWorkbook

'Create link to Excel sheet


'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")

'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(0)
With MItem
.To = "ABC.abc.com"
.cc = "PQR.xyz.com"
.Subject = "Test Mail"
.Body = "Message"
.OriginatorDeliveryReportRequested = True ' delivery confirmation
.ReadReceiptRequested = True ' read confirmation
.Attachments.Add "Y:\abc\xyz.xls"
.display
End With
End Sub


the file xyz.xls have been attached from y: of my system. but the same code can not be used for attaching the same file from clinet end. pls suggest the code to attach the same file after update from ohter end


Thanks
 
Upvote 0
change
Code:
.ReadReceiptRequested = True ' read confirmation
.Attachments.Add "Y:\abc\xyz.xls"
for
Code:
.ReadReceiptRequested = True ' read confirmation
.Attachments.Add ThisWorkbook.Path & "\" & ThisWorkbook.Name
.display
.send
End With
msgbox "Please click yes on the Outlook warning message"
 
Upvote 0
The Outlook warning message can be bypassed by using ADO but i don't agree with not letting the user see what you are doing with their system :)
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,004
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top