
Checking if folder/path exists: Outlook Form
Hi there. I'm trying to figure out a quick and dirty
Visual Basic script
in a form I am working on, and I'm pretty much at the end of my rope
here. I need the script to check and see if certain paths/folders exist
on a file system (and not in the Outlook folders), and then be able to
do error handling. I have tried several different methods with "On
Error" and "If ERR.Number...", but they have failed. Basically, here is
the code:
Function Item_Open()
Item.Body = "blah blah blah"
End Function
Function Item_Send()
Item.Attachments.Add "C:\WINDOWS\DESKTOP\FOO.BAR"
Item.SaveAs "\\ip70\Tech Support\client correspondence\" & Item.To &
"\" & Item.Subject & ".msg"
End Function
The problems happen twofold... First, I want to be able to error out on
the adding of the attachment, having the item not be sent if the
attachment doesn't exist, and giving the user a chance to create the
attachment, and then resend the file. The second problem occurs when the
item is saved... The Item.To is the name of the client AND the directory
(which might not be the same), so I would like a MsgBox to appear
reminding the person to do this manually, but have the email go through
in this case. *sigh*
The error numbers are easy--probably 53 or 76, but when I create the
right conditions, and try to have the program tell me by putting a
"MsgBox ERR.Number" in after the Item.SaveAs line, I just get a
"internal application error", and the email gets sent, but the message
box doesn't appear.
The attachments line used to be within the Item_Open routine, but I
found that my saved form *itself* was getting overloaded with duplicate
attachments, and wasn't updating when a new one was created. Even using
a:
While Attachments.Count > 0
Attachments.Remove 1
Wend
in Item_Open did nothing. The attachments seemed to disappear, but when
the file was received, the user had three of the same files (which was
bad, since the file is over a Meg in size). I even tried taking out the
"Attachments.Add" line, and only have the Attachments.Remove stuff in
the form, but the invisible attachments still wouldn't disappear!
Any help would be much appreciated. Thanks.
Rory
Sent via Deja.com http://www.*-*-*.com/
Before you buy.