Hi Vaibhav ,

Finally now working !!!!!

But once the macro is executed it does generates the auto email with
attachment too.

But it prompts an error " Type Mismatch "

How can we fix this problem ???

Thanks,
Ujjwal


On Mon, Aug 18, 2014 at 6:48 PM, Vaibhav Joshi <v...@vabs.in> wrote:

> Try this code, if file doent exist it will pop up & exit macro.
>
> Try changing file location manually to chek working of code.
>
> Sub CreateMail()
>     Dim objOutlook As Object
>     Dim objMail As Object
>     Dim rngEntry As Range
>     Dim rngEntries As Range
>
>     Set objOutlook = CreateObject("Outlook.Application")
>     Set rngEntries = ActiveSheet.Range("B2:B10")
>     Set rngEntries = ActiveSheet.Range("C2:C10")
>
>     For Each rngEntry In rngEntries
>          Set objMail = objOutlook.CreateItem(0)
>         With objMail
>             .To = rngEntry.Offset(0, -1).Value
>             .CC = rngEntry.Offset(0, 0).Value
>             .Subject = rngEntry.Offset(0, 1).Value
>             .Body = rngEntry.Offset(0, 2).Value
>
>     If Dir(rngEntry.Offset(0, 3).Value) = "" Then
>     MsgBox "File " & rngEntry.Offset(0, 3).Value & " doesnot exists,
> exiting macro."
>     End If
>             .Attachments.Add rngEntry.Offset(0, 3).Value
>             .Display '.Send or .Save
>         End With
>     Next rngEntry
>
>     Set objOutlook = Nothing
>     Set objMail = Nothing
>     Set rngEntry = Nothing
>     Set rngEntries = Nothing
> End Sub
>
> Cheers!!
>
>
> On Mon, Aug 18, 2014 at 5:52 PM, Ujjwal Desai <ujjwal1...@gmail.com>
> wrote:
>
>> Hi Vaibhav,
>>
>> The file path given contains the attachment but still it gives me with
>> the automation error.
>>
>> If you can give me another code or solution I would appreciate.
>>
>> Thanks,
>> Ujjwal
>> On Aug 18, 2014 5:19 PM, "Vaibhav Joshi" <v...@vabs.in> wrote:
>>
>>>  chek if attachment is there in place?
>>>
>>>
>>>
>>>
>>> On Mon, Aug 18, 2014 at 4:32 PM, Ujjwal Desai <ujjwal1...@gmail.com>
>>> wrote:
>>>
>>>> Hello ,
>>>>
>>>> I am trying to send multiple email  with attachment with the help of
>>>> Vba.
>>>>
>>>> Unfortunately I am getting an error “Automation error 440”
>>>>
>>>> Need your help in regards to the attached file.
>>>>
>>>> Awaiting for the reply !!!!!
>>>>
>>>>  Thanks,
>>>> Ujjwal
>>>>
>>>>  --
>>>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be?
>>>> It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
>>>> https://www.facebook.com/discussexcel
>>>>
>>>> FORUM RULES
>>>>
>>>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>>>> will not get quick attention or may not be answered.
>>>> 2) Don't post a question in the thread of another member.
>>>> 3) Don't post questions regarding breaking or bypassing any security
>>>> measure.
>>>> 4) Acknowledge the responses you receive, good or bad.
>>>> 5) Jobs posting is not allowed.
>>>> 6) Sharing copyrighted material and their links is not allowed.
>>>>
>>>> NOTE : Don't ever post confidential data in a workbook. Forum owners
>>>> and members are not responsible for any loss.
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "MS EXCEL AND VBA MACROS" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to excel-macros+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to excel-macros@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/excel-macros.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be?
>>> It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
>>> https://www.facebook.com/discussexcel
>>>
>>> FORUM RULES
>>>
>>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>>> will not get quick attention or may not be answered.
>>> 2) Don't post a question in the thread of another member.
>>> 3) Don't post questions regarding breaking or bypassing any security
>>> measure.
>>> 4) Acknowledge the responses you receive, good or bad.
>>> 5) Jobs posting is not allowed.
>>> 6) Sharing copyrighted material and their links is not allowed.
>>>
>>> NOTE : Don't ever post confidential data in a workbook. Forum owners and
>>> members are not responsible for any loss.
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "MS EXCEL AND VBA MACROS" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/excel-macros/j6A9zAu9Ljk/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> excel-macros+unsubscr...@googlegroups.com.
>>>
>>> To post to this group, send email to excel-macros@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/excel-macros.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
>> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
>> https://www.facebook.com/discussexcel
>>
>> FORUM RULES
>>
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>> will not get quick attention or may not be answered.
>> 2) Don't post a question in the thread of another member.
>> 3) Don't post questions regarding breaking or bypassing any security
>> measure.
>> 4) Acknowledge the responses you receive, good or bad.
>> 5) Jobs posting is not allowed.
>> 6) Sharing copyrighted material and their links is not allowed.
>>
>> NOTE : Don't ever post confidential data in a workbook. Forum owners and
>> members are not responsible for any loss.
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "MS EXCEL AND VBA MACROS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to excel-macros+unsubscr...@googlegroups.com.
>> To post to this group, send email to excel-macros@googlegroups.com.
>> Visit this group at http://groups.google.com/group/excel-macros.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/excel-macros/j6A9zAu9Ljk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> excel-macros+unsubscr...@googlegroups.com.
> To post to this group, send email to excel-macros@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to