-
I used this code to save attachments inserted in an e-mail.
Dim out As Outlook.Application
Dim myItem As MailItem
Set out = CreateObject("outlook.application")
Set myItem = out.ActiveInspector.CurrentItem
myItem.attachments.Item(1).SaveAsFile PathAttachments
Then Message error is :
Object variable or with block variable not set!!!
What is happened????
Please help me!!!!!
Thanks....
-
Rafael:
I know I already answered this for you, but in case anybody else is having the same issue, here is what I sent to Rafael:
When you set something to an object, or part of an object
as MyItem is set, you do not have to define the variables.
The set keyword does this for you. In VBscript, you can
define the variables if you wish by using the keyword Dim
however in VBS everything is a varient anyway so there's
not much of a point and in my opinion it just takes up
space. But if you were going to declare your variables,
you would do it as follows:
Code:
Dim out
Dim myItem
Set out = createobject("outlook.application")
Set myItem = out.ActiveInspector.CurrentItem
myItem.attachments.item(1).saveasfile "c:\whatever.txt"