Results 1 to 32 of 32

Thread: how to make lable of address and how to connect vb to outlook for send email

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question 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..........

  2. #2
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    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:
    1. Dim App As Outlook.Application
    2. Dim Mail1 As Outlook.MailItem
    3. Dim Mail2 As Outlook.MailItem
    4. Dim Mail3 As Outlook.MailItem
    5. Dim Mail4 As Outlook.MailItem
    6. Dim Mail5 As Outlook.MailItem
    7. Set App = CreateObject("Outlook.Application")
    8. Set Mail1 = App.CreateItem(olMailItem)
    9. Set Mail2 = App.CreateItem(olMailItem)
    10. Set Mail3 = App.CreateItem(olMailItem)
    11. Set Mail4 = App.CreateItem(olMailItem)
    12. Set Mail5 = App.CreateItem(olMailItem)
    13.  
    14.  
    15. Dim var1, var2, var3, var4, var5
    16. Dim var6, var7, var8, var9, var10
    17. Dim var11, var12, var13, var14, var15
    18. Dim var16, var17, var18, var19, var20
    19. Dim body, subject
    20.  
    21. 'if corresponding check box is checked:
    22. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    23. If chkcasenum.Value = 1 Then
    24. 'variable subject and body:
    25. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    26. subject = "TECHNICAL SUPPORT ASSISTANCE: Case Number"
    27. body = "Dear: " & frmmain.txtcontact.Text & "<br><br>" & _
    28.             "<font color = 0066FF>You Have Reached TRINET HELPDESK v1.3a SUPPORT SYSTEM </font>" & "<br><br><br>" & _
    29.             "<font color = 0066FF>Listed Below are the Information that you have requested:<br><br></font>" & _
    30.             "<font color = 0066FF>Case Number: </font>" & frmmain.txtcasenum.Text & _
    31.             "<font color = 0066FF><br><br><br>Thank you for Teaming Up with Team TRINET!</font>" & _
    32.             "<font color = 0066FF><br><br>Regards,<br>Trinet Technical Support Team</font>"
    33. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    34. 'send email:
    35. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    36. With Mail1
    37. .To = Trim(frmmain.txtemail.Text)
    38. '.CC = "sm\em\[email protected]"
    39. '.BCC = "eng/am involved"
    40. .subject = subject
    41. .HTMLBody = body
    42.  
    43. '.Attachments.Add "\\server\drive\folder\filename", olByValue, 1
    44. .Send
    45. End With
    46. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    47. Else
    48. var1 = ""
    49. End If
    you need to add the reference though...
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  3. #3

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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

  4. #4

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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

  5. #5

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: how to make lable of address and how to connect vb to outlook for send email

    help here????

  6. #6

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: how to make lable of address and how to connect vb to outlook for send email

    help plese

  7. #7
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: how to make lable of address and how to connect vb to outlook for send email

    Have you added reference to outlook?
    CS

  8. #8
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: how to make lable of address and how to connect vb to outlook for send email

    VB Code:
    1. 'In your project go to References and click Microsoft Outlook 8.0/11.0 Object Library.
    2.  
    3. ' make sure a reference to the Outlook object is set
    4. ' place the following code in a command button click event
    5. Private Sub cmdSendMail_Click()
    6.     Dim objOutlook As Outlook.Application
    7.     Dim objMailItem As Outlook.MailItem
    8.     Set objOutlook = New Outlook.Application
    9.     Set objMailItem = objOutlook.CreateItem(olMailItem)
    10.     With objMailItem.To = "ToAddress"  'recipient's address
    11.         .Subject = "subject"  'subject box content
    12.         .Body = "email message"  ' message goes here
    13.         .Attachment = "c:\path\file.txt"    ' attach any files here
    14.         .Send
    15.     End With
    16.     Set objMailItem = Nothing
    17.     Set objOutlook = Nothing
    18. End Sub
    CS

  9. #9
    Fanatic Member esposito's Avatar
    Join Date
    Sep 2003
    Location
    Perugia, Italy
    Posts
    961

    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

  10. #10

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: how to make lable of address and how to connect vb to outlook for send email

    Have you added reference to outlook?
    how to do??

  11. #11
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    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
    CS

  12. #12

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: how to make lable of address and how to connect vb to outlook for send email

    VB Code:
    1. With objMailItem.To = "ToAddress"
    here error occuring with must be user defined type object or varient after adding outlook library

  13. #13

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: how to make lable of address and how to connect vb to outlook for send email

    help

  14. #14
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    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]
    CS

  15. #15

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: how to make lable of address and how to connect vb to outlook for send email

    VB Code:
    1. With objMailItem.To = "[email protected]"

    same error occuring as mantion in post 12

  16. #16
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: how to make lable of address and how to connect vb to outlook for send email

    Try this:
    VB Code:
    1. 'In your project go to References and click Microsoft Outlook 8.0/11.0 Object Library.
    2.  
    3. ' make sure a reference to the Outlook object is set
    4. ' place the following code in a command button click event
    5. Private Sub cmdSendMail_Click()
    6.     Dim objOutlook As Outlook.Application
    7.     Dim objMailItem As Outlook.MailItem
    8.     Set objOutlook = New Outlook.Application
    9.     Set objMailItem = objOutlook.CreateItem(olMailItem)
    10.     With objMailItem
    11.         .To = "ToAddress"  'recipient's address
    12.         .Subject = "subject"  'subject box content
    13.         .Body = "email message"  ' message goes here
    14.         .Attachment = "c:\path\file.txt"    ' attach any files here
    15.         .Send
    16.     End With
    17.     Set objMailItem = Nothing
    18.     Set objOutlook = Nothing
    19. End Sub
    CS

  17. #17

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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
    VB Code:
    1. .Send

    and object does not this property of meathod error here

    VB Code:
    1. .Attachment = "c:\path\file.txt"    ' attach any files here

    three error occuring i m using ur last post this one

    VB Code:
    1. Private Sub cmdSendMail_Click()
    2.     Dim objOutlook As Outlook.Application
    3.     Dim objMailItem As Outlook.MailItem
    4.     Set objOutlook = New Outlook.Application
    5.     Set objMailItem = objOutlook.CreateItem(olMailItem)
    6.     With objMailItem
    7.         .To = "ToAddress"  'recipient's address
    8.         .Subject = "subject"  'subject box content
    9.         .Body = "email message"  ' message goes here
    10.         .Attachment = "c:\path\file.txt"    ' attach any files here
    11.         .Send
    12.     End With
    13.     Set objMailItem = Nothing
    14.     Set objOutlook = Nothing
    15. End Sub

  18. #18

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: how to make lable of address and how to connect vb to outlook for send email

    any solution here

  19. #19

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. .Attachments.Add = "c:\path\file.txt"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  21. #21

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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.
    how to do??

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  23. #23

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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
    nothing happening
    tell me in brief

  24. #24
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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...
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  25. #25

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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??

  26. #26
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  27. #27

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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

  28. #28
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  29. #29

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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??

  30. #30
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  31. #31

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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.
    ok but i define three problem in post 17 plese u check the code is there is any wrong by me

  32. #32
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width