-
how to make lable of address and how to connect vb to outlook for send email
hi all
i m making a address book software but problem occuring
after searching any person i want want to make a label as a address it save in my database as address,city,pincode
next i want to send email to all person using outlook
when i click on selected email they all come back in out look
how it is possible..........
help me.....
thanks..........
-
Re: how to make lable of address and how to connect vb to outlook for send email
here's a sample... try to edit...
VB Code:
Dim App As Outlook.Application
Dim Mail1 As Outlook.MailItem
Dim Mail2 As Outlook.MailItem
Dim Mail3 As Outlook.MailItem
Dim Mail4 As Outlook.MailItem
Dim Mail5 As Outlook.MailItem
Set App = CreateObject("Outlook.Application")
Set Mail1 = App.CreateItem(olMailItem)
Set Mail2 = App.CreateItem(olMailItem)
Set Mail3 = App.CreateItem(olMailItem)
Set Mail4 = App.CreateItem(olMailItem)
Set Mail5 = App.CreateItem(olMailItem)
Dim var1, var2, var3, var4, var5
Dim var6, var7, var8, var9, var10
Dim var11, var12, var13, var14, var15
Dim var16, var17, var18, var19, var20
Dim body, subject
'if corresponding check box is checked:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If chkcasenum.Value = 1 Then
'variable subject and body:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
subject = "TECHNICAL SUPPORT ASSISTANCE: Case Number"
body = "Dear: " & frmmain.txtcontact.Text & "<br><br>" & _
"<font color = 0066FF>You Have Reached TRINET HELPDESK v1.3a SUPPORT SYSTEM </font>" & "<br><br><br>" & _
"<font color = 0066FF>Listed Below are the Information that you have requested:<br><br></font>" & _
"<font color = 0066FF>Case Number: </font>" & frmmain.txtcasenum.Text & _
"<font color = 0066FF><br><br><br>Thank you for Teaming Up with Team TRINET!</font>" & _
"<font color = 0066FF><br><br>Regards,<br>Trinet Technical Support Team</font>"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'send email:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
With Mail1
.To = Trim(frmmain.txtemail.Text)
'.BCC = "eng/am involved"
.subject = subject
.HTMLBody = body
'.Attachments.Add "\\server\drive\folder\filename", olByValue, 1
.Send
End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Else
var1 = ""
End If
you need to add the reference though...
-
Re: how to make lable of address and how to connect vb to outlook for send email
i m using this coding at form load error occuring user defined type not defined in first line
-
Re: how to make lable of address and how to connect vb to outlook for send email
check ur self on form load tell where and how to use
-
Re: how to make lable of address and how to connect vb to outlook for send email
-
Re: how to make lable of address and how to connect vb to outlook for send email
-
Re: how to make lable of address and how to connect vb to outlook for send email
Have you added reference to outlook?
-
Re: how to make lable of address and how to connect vb to outlook for send email
VB Code:
'In your project go to References and click Microsoft Outlook 8.0/11.0 Object Library.
' make sure a reference to the Outlook object is set
' place the following code in a command button click event
Private Sub cmdSendMail_Click()
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem.To = "ToAddress" 'recipient's address
.Subject = "subject" 'subject box content
.Body = "email message" ' message goes here
.Attachment = "c:\path\file.txt" ' attach any files here
.Send
End With
Set objMailItem = Nothing
Set objOutlook = Nothing
End Sub
-
Re: how to make lable of address and how to connect vb to outlook for send email
Do you think it is possible to modify the code above creating an Outlook object through (late binding) code instead of making a reference to the Outlook object? This way the app would not require an installation to run and could even be used in a LAN by simply placing the executable in a shared folder.
Can anybody help to make the necessary modifications?
TIA
-
Re: how to make lable of address and how to connect vb to outlook for send email
Quote:
Have you added reference to outlook?
how to do??
-
Re: how to make lable of address and how to connect vb to outlook for send email
I already mentioned in post #8. any way,
Go to project -> references ->
and Select Microsoft Outlook 11.0 Object Library (or whatever version you have) option
-
Re: how to make lable of address and how to connect vb to outlook for send email
VB Code:
With objMailItem.To = "ToAddress"
here error occuring with must be user defined type object or varient after adding outlook library
-
Re: how to make lable of address and how to connect vb to outlook for send email
-
Re: how to make lable of address and how to connect vb to outlook for send email
you need to enter the to address on that like [email protected]
-
Re: how to make lable of address and how to connect vb to outlook for send email
same error occuring as mantion in post 12
-
Re: how to make lable of address and how to connect vb to outlook for send email
Try this:
VB Code:
'In your project go to References and click Microsoft Outlook 8.0/11.0 Object Library.
' make sure a reference to the Outlook object is set
' place the following code in a command button click event
Private Sub cmdSendMail_Click()
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.To = "ToAddress" 'recipient's address
.Subject = "subject" 'subject box content
.Body = "email message" ' message goes here
.Attachment = "c:\path\file.txt" ' attach any files here
.Send
End With
Set objMailItem = Nothing
Set objOutlook = Nothing
End Sub
-
Re: how to make lable of address and how to connect vb to outlook for send email
first this massage
a program throwing outomaticall email do u want to allow it yes or no
occuring
on clicking no error occuring application defined or object defined error
on clicking yes error occuring outlook does not recnoze one or more name
on this code
and object does not this property of meathod error here
VB Code:
.Attachment = "c:\path\file.txt" ' attach any files here
three error occuring i m using ur last post this one
VB Code:
Private Sub cmdSendMail_Click()
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.To = "ToAddress" 'recipient's address
.Subject = "subject" 'subject box content
.Body = "email message" ' message goes here
.Attachment = "c:\path\file.txt" ' attach any files here
.Send
End With
Set objMailItem = Nothing
Set objOutlook = Nothing
End Sub
-
Re: how to make lable of address and how to connect vb to outlook for send email
-
Re: how to make lable of address and how to connect vb to outlook for send email
How To Slove Problem Of Post 17 Thanks
-
Re: how to make lable of address and how to connect vb to outlook for send email
The popup security dialog can not be surpressed with your code. One way would be to write Outlook VBA code and use the trusted application object.
For the attachment you need to use the .Add method.
VB Code:
.Attachments.Add = "c:\path\file.txt"
-
Re: how to make lable of address and how to connect vb to outlook for send email
Quote:
The popup security dialog can not be surpressed with your code. One way would be to write Outlook VBA code and use the trusted application object.
how to do??
-
Re: how to make lable of address and how to connect vb to outlook for send email
Press Alt+F11 from Outlook to access its VBA IDE.
-
Re: how to make lable of address and how to connect vb to outlook for send email
Quote:
Press Alt+F11 from Outlook to access its VBA IDE
nothing happening
tell me in brief
-
Re: how to make lable of address and how to connect vb to outlook for send email
You are using Outlook and NOT Outlook Express?
Alt+F11 = Tools > Macro > Visual Basic Editor...
-
Re: how to make lable of address and how to connect vb to outlook for send email
main this is that i wnat to connect vb to outlook is it possible or not??
-
Re: how to make lable of address and how to connect vb to outlook for send email
Yes it is and we have provided code to do so but you havent replied to which version of Outlook or Outlook Express you are running as it makes a huge difference.
-
Re: how to make lable of address and how to connect vb to outlook for send email
i have 2002 version of outlook
and i used the above code lot of error occur see the post 17
-
Re: how to make lable of address and how to connect vb to outlook for send email
Ok, then when you have Outlook open and running go to the Tools menu and click Macro > Viusual Basic Editor...
I posted the workarounds and fixes in post #20.
-
Re: how to make lable of address and how to connect vb to outlook for send email
i m not able to understand what u want to say??
-
Re: how to make lable of address and how to connect vb to outlook for send email
Post #20 contains the solution for your attachment problem.
For the security popup you need to wriute your code in Outlooks VBA editor as shown in post #24 and #28.
-
Re: how to make lable of address and how to connect vb to outlook for send email
Quote:
Post #20 contains the solution for your attachment problem.
ok but i define three problem in post 17 plese u check the code is there is any wrong by me
-
Re: how to make lable of address and how to connect vb to outlook for send email
Again, 1 an 2 are by design of the Outlook security Object Model Guard.
3 is because you either dont have a valid email address or you didnt .Resolve the address assigned to the .To property of the mailitem object.