Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stripping outlook attachments

Status
Not open for further replies.

ApplePirate

Programmer
Dec 16, 2002
65
GB
Ive obtained this code from another thread,

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


can anyone tell me how i remove the "pickfolder" option and replace with default folder to look in?



 
If you have a look at the options shown when you type

objNameSpace.

you will notice that there is a GetDefaultFolder which you can use to the the default folder to the inbox.
 
for some reason i think that the outlook that i use is crippled in some way. i have noticed on other threads that alt & f11 will bring up the scripting editor. this doesnt happen. also some people have told me to save as a module but ive been unable to this.
what im doing is opening an item and choosing 'design this form' from the tools - form menu. then in design view choosing form - code to open the script editor. so when i input code there are no code helpers such as the ones in access or VB. thats why i think im struggling. also ive tried other code and keep getting errors if any declarations have extra tags. e.g.
Dim fldDefault as object

can someone please help

any help is much appreciated

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top