File permission problem

R

rpick60

I have created code to paste a email to a cell as a object. Then I
copy the email to a folder and everything works fine but i am unable
to open the email that was saved to the folder.
I get permission denied. I have check all of the folders and I do have
read/write. If i copy manually it will open the email just fine. Here
is the code. Please Help!!!!!!!


Sub Test()

Dim srfld As String
Dim emfld As String
srfld = ActiveCell.Offset(-1, 1).Range("A1") 'folder path of date
of email ex: 3-2-12
emfld = ActiveCell.Offset(0, 2).Range("A1") 'Folder path of above
and subjeect of email
On Error Resume Next
MkDir srfld
On Error GoTo 0

On Error Resume Next
MkDir emfld
On Error GoTo 0
' copy latest pasted email
Dim i As Integer
i = ActiveSheet.Shapes.Count
ActiveSheet.Shapes(i).Copy

CreateObject("Shell.Application") _
.Namespace(CVar(emfld)).Self.InvokeVerb "paste"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top