Need help!! vb code
It is urgent, please help
This code is a macro under MS OUTLOOK
It works, but I need to save strreport info into word/excel/text file
Tried to enter a line as
strreport.saveasfile "c:\report.txt" give me an compile error.
instead of " MsgBox strReport "
It is urgent, please help
Sub SendersInFolder()
Dim onsMapi As Outlook.NameSpace
Dim ofolderSource As Outlook.MAPIFolder
Dim omsgItem As Outlook.MailItem
Dim strReport As String
' Get the current Folder
Set onsMapi = Application.GetNamespace("MAPI")
Set ofolderSource = Application.ActiveExplorer.CurrentFolder
' Check for messages in Folder
If ofolderSource.Items.Count = 0 Then
strReport = "No Mail Items in current Folder"
Else
For Each omsgItem In ofolderSource.Items
' Get the Sender's name and Email address
strReport = strReport & omsgItem.SenderName & " / " & GetSenderID(omsgItem) & vbCrLf
Next
End If
MsgBox strReport
' Clean Up
Set ofolderSource = Nothing
Set onsMapi = Nothing
Set omsgItem = Nothing
End Sub
Thanks for you help in advance.
aspag
It is urgent, please help
This code is a macro under MS OUTLOOK
It works, but I need to save strreport info into word/excel/text file
Tried to enter a line as
strreport.saveasfile "c:\report.txt" give me an compile error.
instead of " MsgBox strReport "
It is urgent, please help
Sub SendersInFolder()
Dim onsMapi As Outlook.NameSpace
Dim ofolderSource As Outlook.MAPIFolder
Dim omsgItem As Outlook.MailItem
Dim strReport As String
' Get the current Folder
Set onsMapi = Application.GetNamespace("MAPI")
Set ofolderSource = Application.ActiveExplorer.CurrentFolder
' Check for messages in Folder
If ofolderSource.Items.Count = 0 Then
strReport = "No Mail Items in current Folder"
Else
For Each omsgItem In ofolderSource.Items
' Get the Sender's name and Email address
strReport = strReport & omsgItem.SenderName & " / " & GetSenderID(omsgItem) & vbCrLf
Next
End If
MsgBox strReport
' Clean Up
Set ofolderSource = Nothing
Set onsMapi = Nothing
Set omsgItem = Nothing
End Sub
Thanks for you help in advance.
aspag