This is your problem:
Set objOutlook = CreateObject("Outlook.Application")
To avoid security prompts, you must use the intrinsic Application object. You can do this by changing the above statement to:
Set objOutlook = Application
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"Nadeem" <(E-Mail Removed)> wrote in message news:107D79D5-6F51-436A-92C4-(E-Mail Removed)...
> Sue,
>
> Sorry abt the repetition. following the part of the code for sending email.
>
> Nadeem
>
> ----
> .
> .
> .
> Dim objOutlook As Outlook.Application
> Dim objOutlookMsg As Outlook.mailItem
> Dim objOutlookRecip As Outlook.Recipient
> 'Create the Outlook session.
> Set objOutlook = CreateObject("Outlook.Application")
> ' Create the message.
> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
>
> With objOutlookMsg
> 'Add the To recipient(s) to the message.
> Do While (j < MAX_NO_MAILS )
> 'read mail id from file
> sRecord = oStream1.readLine()
> Set objOutlookRecip = .Recipients.Add(sRecord)
> objOutlookRecip.Type = olBCC
> Loop
> .Subject = "subj"
> .HTMLBody = "body"
> .Importance = olImportanceNormal
>
> ' Resolve each Recipient's name.
> For Each objOutlookRecip In .Recipients
> objOutlookRecip.Resolve
> Next
>
> .Save
> .Send
>
> End With
> .
> .
> .
> ----
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> Repeating: All objects need to derive from the intrinsic Application object in Outlook VBA. Show how you instantiate objOutlookRecip and all of its parent objects.
>>
>>
>> "Nadeem" <(E-Mail Removed)> wrote in message news:80BF973E-5841-45CF-A25C-(E-Mail Removed)...
>> > Sue,
>> > thanks for the rapid response.
>> > our macro displays a security warning on the following line. is there a
>> > workaround for this?
>> > ---
>> > Set objOutlookRecip = ..Recipients.Add(sRecord)
>> > objOutlookRecip.Type = olBCC
>> > ---
>> >
>> > Nadeem
>> >
>> > "Sue Mosher [MVP-Outlook]" wrote:
>> >
>> >> An Outlook macro? Then you didn't construct it correctly. All objects need to derive from the intrinsic Application object in Outlook VBA.
>> >>
>> >> --
>> >> Sue Mosher, Outlook MVP
>> >> Author of Configuring Microsoft Outlook 2003
>> >> http://www.turtleflock.com/olconfig/index.htm
>> >> and Microsoft Outlook Programming - Jumpstart for
>> >> Administrators, Power Users, and Developers
>> >> http://www.outlookcode.com/jumpstart.aspx
>> >>
>> >>
>> >> "Nadeem" <(E-Mail Removed)> wrote in message news:68CC1CC7-F929-43F9-8E58-(E-Mail Removed)...
>> >> > We are using a macro to send mails to users from Outlook 2003. We want to
>> >> > avoid the security popup which asks to allow/disallow for max of 10 mins.
>> >> >
>> >> > We are using Recipients.add().
>> >> >
>> >> > Please help.
>> >> >
>> >> > Regards
>> >> >
>> >>
>>