Save file.msg to folder and test if exist
Good afternoon,
I need help to complete a project.
The idea is to save the mail folder whose path is already set. So far already solved.
Problem:
1) If the name assign already exists, it replaces the existing one.
2) If I assign no name (blank) it saves without any name (blank - unnamed).
3) I have a list of all files in a listbox (userform). How do I after creating/save another file, the listbox update the list.
So far I have the following:
Code:
Sub SaveAsMSG()
' Gravar ficheiro na pasta
Dim objItem As Outlook.MailItem
Dim strPrompt As String, strname As String
Dim sreplace As String, mychar As Variant, strdate As String
Set objItem = Outlook.ActiveExplorer.Selection.Item(1)
If objItem.Class = olMail Then
strname = UserForm1.TextBox3.Value
myPath = UserForm1.TextBox2.Value & "/" & UserForm1.TextBox1.Value
If myPath = False Then
MsgBox "Não indicou nenhum caminho para guardar!!!", vbExclamation
Else
objItem.SaveAs myPath & "\" & strname & ".msg", olMSG
End If
End If
End Sub
thanks in advance