ApplePirate
Programmer
Im using this bit of code to move attachments from outlook to a specified folder.
------------------------------------------------------
------------------------------------------------------
option explicit
Function Item_Open()
dim objNameSpace
dim objFolder
dim objItem
dim objAttachment
dim intIndex
dim intIndex2
dim strFiles
set objNameSpace = Application.GetNameSpace("MAPI"
set objFolder = objNameSpace.PickFolder
for intIndex = 1 to objFolder.Items.Count
set objItem = objFolder.Items(intIndex)
if objItem is nothing then
else
for intIndex2 = 1 to objItem.Attachments.Count
set objAttachment = objItem.Attachments(intIndex2)
if objAttachment is nothing then
else
objAttachment.SaveAsFile "c:import\" & objAttachment.FileName
strFiles = strFiles & objAttachment.FileName & vbCR
end if
next
end if
next
Item.Body = strFiles
End Function
------------------------------------------------------
------------------------------------------------------
the line "set objFolder = objNameSpace.PickFolder" produces a pop up browser window from which i choose a folder. Is there a way of setting a folder in the script so i dont have to choose from the browser.
Never ever, bloody anything, ever
------------------------------------------------------
------------------------------------------------------
option explicit
Function Item_Open()
dim objNameSpace
dim objFolder
dim objItem
dim objAttachment
dim intIndex
dim intIndex2
dim strFiles
set objNameSpace = Application.GetNameSpace("MAPI"
set objFolder = objNameSpace.PickFolder
for intIndex = 1 to objFolder.Items.Count
set objItem = objFolder.Items(intIndex)
if objItem is nothing then
else
for intIndex2 = 1 to objItem.Attachments.Count
set objAttachment = objItem.Attachments(intIndex2)
if objAttachment is nothing then
else
objAttachment.SaveAsFile "c:import\" & objAttachment.FileName
strFiles = strFiles & objAttachment.FileName & vbCR
end if
next
end if
next
Item.Body = strFiles
End Function
------------------------------------------------------
------------------------------------------------------
the line "set objFolder = objNameSpace.PickFolder" produces a pop up browser window from which i choose a folder. Is there a way of setting a folder in the script so i dont have to choose from the browser.
Never ever, bloody anything, ever