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!
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!