Run-time error '-2147467259 (80004005)'

L

Lynn

hi,
i have got a pop-up error message "Run-time error '-2147467259
(80004005)'
The operation failed. when i run this macro in outlook. pls help.
thanks

Sub SaveItems()


Dim objItem As Object
Dim objSelection As Selection
Dim strPath As String
Dim strFile As String
Dim intCounter As Integer


'Retrieve a reference to the selected items in the active folder
Set objSelection = Application.ActiveExplorer.Selection


If objSelection.Count = 0 Then
MsgBox "You must select at least one item to save first.",
vbCritical,
"No Items Selected"
Else
'Initialize variables
strPath = "c:"
intCounter = 0
'Cycle through all items in the selection
For Each objItem In objSelection
'Increment the counter
intCounter = intCounter + 1
'Create the filename
strFile = strPath & Format$(intCounter, "000") & " - " &
objItem.Subject & ".msg"
'Save the item
objItem.SaveAs strFile, olMSG
Next


Set objItem = Nothing


MsgBox intCounter & " items were saved to " & strPath


End If


Set objSelection = Nothing


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