How to select the recently attached attachment and save a copy?

kcutd05

New Member
Joined
Sep 29, 2015
Messages
1
Hi all,


I'm using vba to create an email and prompt the user to attach an attachment which works, but I would also like to add some code to save the attachment the user just added to another location.

while I am at it I would like change the file the user just attached and add a value from the user form to the end

example user adds attachment "abc123.xlsx" I would like to add what the user entered in the userform me.textbox1.text

so something like abc123 & me.textbox1.text -- the text they used



' browse file cell... is the path the user selected for their file
' adds the file to the email.
.Attachments.Add (ActiveWorkbook.Worksheets("BrowseFile").Cells(4, 3).Value)

' this is where I want to save a copy of what was just added it's going to be in sharepoint, but I would like to be able to at least save it locally say in documents or anywhere locally.

I tried a lot of things about copy and save, but I don't see anything about referencing the "open email attachment location".


' problem with this is the source

FileSystemObject.CopyFile "c:\mydocuments\letters\*.doc", "c:\tempfolder"
examples of things I've tried


' not sure I'm using this correctly/ getting object required
instance.SaveAsFile ("C:\123")


lots of others..


Any help would be great! Thank you!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,216,499
Messages
6,131,010
Members
449,613
Latest member
MedDash99

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