Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasting e-mail (eg) from clipboard to folder in VBA / Excel??

Status
Not open for further replies.

cresbydotcom

Technical User
May 22, 2006
234
OK this opens explorer and can paste manually
Code:
Private Sub emal_Click()
abc = "destination base folder"
dummy = Shell("explorer.exe /e, """ & abc & "\e-mails""", vbNormalNoFocus)
End Sub
But is there a way of pasting the clipboard item (ref or actual) to the actual folder location?

SendKeys might work but I prefer it to be more transparent.

any ideas?


there is a tide in the affairs of man that you Cnut ignore.................
 
yea been there done that many times.
But to put the e-mail in a folder in win explorer seems a bit too obscure at the moment. manually I just click in the folder and paste. But in VBA?
With attachments? Text is the easy bit.

Any other ideas?


there is a tide in the affairs of man that you Cnut ignore.................
 
Well I didn't figure how to do it but Outlook had switched-off macros (remote from HQ was doing something)

But they are back since I re-booted so I can use the existing Outlook macros. viz

Code:
    Dim objApp As Outlook.Application
    Dim objSel As Outlook.Selection
    Dim x As Integer
    Dim sSubjectName As String
    Dim ynTried As Boolean
    
'   Find the currently selected emails
    Set objApp = CreateObject("Outlook.Application")
    Set objSel = objApp.ActiveExplorer.Selection

' For each email
    For x = 1 To objSel.Count
        With objSel.Item(x)
        ' perform save only on selected mail messages
            If .Class = olMail Then
            ' some subjects are unsuitable for file names
            ' so allow renaming if necessary
                If .Subject = "" Then sSubjectName = InputBox("no subject for file name, give me one") Else sSubjectName = .Subject
            End If
 sSubjectName = isok(sSubjectName)
 .SaveAs masterline & "\" & sSubjectName & ".msg", olMSG
 End With
Next

there is a tide in the affairs of man that you Cnut ignore.................
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top