brkkrkmz112
New Member
- Joined
- Oct 24, 2016
- Messages
- 43
Hi,
I am trying to store the files by using getfolder but even there are 6 different types of files my object only store four of them.
The only thing I can notice as difference is that the files that are ignored have very long file name.
As you may see in the link below, count is indicates as 6 but there are only 4 item below.
Thanks in advance.
https://i.imgyukle.com/2019/10/10/Ex4msI.jpg
I am trying to store the files by using getfolder but even there are 6 different types of files my object only store four of them.
The only thing I can notice as difference is that the files that are ignored have very long file name.
As you may see in the link below, count is indicates as 6 but there are only 4 item below.
Thanks in advance.
https://i.imgyukle.com/2019/10/10/Ex4msI.jpg
Code:
Sub Makro2()
Dim objOL As New Outlook.Application
Dim Msg As Outlook.MailItem
Dim oldName
Dim newname As String
Dim fso As New FileSystemObject
Dim mysource As Object
Dim p1 As String
Dim p2 As String
Dim i As Long
Dim Files As Variant
For i = 6 To 4872
p1 = Cells(i, 1)
p2 = "C:\Y"
Shell "explorer.exe " & p1, vbNormalFocus
Set mysource = fso.GetFolder(CStr(p1))
For Each Files In mysource.Files
If Files.Type Like "Outlook*" Then
Set Msg = objOL.Session.OpenSharedItem(Files)
Msg.Display
fso.CreateFolder "C:\Y\" & i
Msg.SaveAs "C:\Y\" & i & "\" & Right(Files.Name, 50) & ".msg", olMSG
Msg.Close olDiscard
End If
Next Files
Next i
End Sub