+ Reply to Thread
Results 1 to 19 of 19

send data between other office programs?

  1. #1
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164

    send data between other office programs?

    Is it possible to send the contents of a cell to outlook via VBA trigger?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Yes, but as what?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Quote Originally Posted by royUK
    Yes, but as what?
    just as text, if you have any how-to's I could certainly figure it out not to trouble you.

    I have a row of cells which contains a persons name, and I want to be able to send that name to outlook as the addressee, and the title of the e-mail pulled from one of the cells, and the body pulled from comments. All of this real time from a button or keystroke to execute the macro/code against the current row and pop up a outlook mail window and populate the various fields. I know how to reference the comments, I just need to know how to send the data across to outlook.

  4. #4
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    is there any how-to's I might find this information on?

  5. #5
    Registered User
    Join Date
    07-05-2007
    Location
    Cincinnati, OH
    Posts
    44

    Smile Re:

    Check out this site

    http://www.erlandsendata.no/english/index.php

    and look under the OLE automation

    I've used their code to create appointments in outlook via macros. For the most part, you can copy and paste with minimal tweaking, but you're going to have to figure out some VB to be able to use it.

    good luck!

  6. #6
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Quote Originally Posted by ilovedurango
    Check out this site

    http://www.erlandsendata.no/english/index.php

    and look under the OLE automation

    I've used their code to create appointments in outlook via macros. For the most part, you can copy and paste with minimal tweaking, but you're going to have to figure out some VB to be able to use it.

    good luck!
    Well with everyone's help I am getting better. This particular code will not run though. I think it may be due to security priveledges or possibly my excel version. Any idea what would cause the error message "User defined type not defined".

  7. #7
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Well, I read into it a bit, and it appears I don't know enough about VBA to do this unfortunately. The code supplied doesn't seem to work for me. I did create a late binding code set and ran it, however it states that it isn't supported... so not sure what the hell is going on.. The code itself looks pretty simplistic, however it just doesn't work for me and I can't figure it out.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Is there some trick I've missed in using OLE automation?

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Pyrex238,

    I suspect you need to set a reference in VBA to the Outllook library. If the reference is missing then the VBE won't be able to match the Outlook VBA code to any existing references. The VBE then assumes these objects are user defined types.

    To Set/Check a library reference:
    1.) With Excel open, press ALT+F11 to open the VBE
    2.) Press ALT+T to activate the Tools Menu
    3.) Press r to display the References Dialog
    4.) Scroll through the list and look for Microsoft Outlook x.x Object library (x.x is the version number)
    5.) Click the check box to set it, and click OK to set the reference

    You may have a problem using this code on later version of Office since this code was written for Outlook 8.0.(pre 2000) If you still have a problem after the reference has been set, then the code will have to be cleaned to work with the version of Office you have.

    Sincerely,
    Leith Ross

  10. #10
    Registered User
    Join Date
    07-05-2007
    Location
    Cincinnati, OH
    Posts
    44

    Smile What information?

    Edit:

    I am sorry, I did not read further up on the thread.

    What version of Excel are you using? If you send me a dummy file, I can make the code work for your application.
    Last edited by ilovedurango; 07-11-2007 at 04:56 PM.

  11. #11
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Quote Originally Posted by Leith Ross
    Hello Pyrex238,

    I suspect you need to set a reference in VBA to the Outllook library. If the reference is missing then the VBE won't be able to match the Outlook VBA code to any existing references. The VBE then assumes these objects are user defined types.

    To Set/Check a library reference:
    1.) With Excel open, press ALT+F11 to open the VBE
    2.) Press ALT+T to activate the Tools Menu
    3.) Press r to display the References Dialog
    4.) Scroll through the list and look for Microsoft Outlook x.x Object library (x.x is the version number)
    5.) Click the check box to set it, and click OK to set the reference

    You may have a problem using this code on later version of Office since this code was written for Outlook 8.0.(pre 2000) If you still have a problem after the reference has been set, then the code will have to be cleaned to work with the version of Office you have.

    Sincerely,
    Leith Ross
    Thanks Leith, I had actually already set up the library files before making the post, it wasn't any help unfortunately. I appreciate your time though.

  12. #12
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Quote Originally Posted by ilovedurango
    Edit:

    I am sorry, I did not read further up on the thread.

    What version of Excel are you using? If you send me a dummy file, I can make the code work for your application.
    I would certainly be ecstatic if you could. The code above in the thread is what I'm needing to work. I can take care of the data, I just need to get outlook to fire up and take the data from various cells. I'm using Excel 2003 SP1 here in the office.

    If you do in fact want the spreadsheet I'm applying it to, I could certainly supply it.

  13. #13
    Registered User
    Join Date
    07-05-2007
    Location
    Cincinnati, OH
    Posts
    44
    I will work on it tonight.

    Please supply the spreadsheet (or at least the dummy version). That way I can make the code as accurate as possible. I'll be working with Excell 2000, but there shouldn't be too much of a difference.
    Last edited by ilovedurango; 07-12-2007 at 03:41 PM.

  14. #14
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Anyone care to share some insight?

  15. #15
    Registered User
    Join Date
    05-02-2006
    Posts
    80
    Hi,

    Watching this with interest. Any success yet?

    It might be trickier than first thought. I think I remember reading something that said that Outlook had been tightened up against access from other programs. What you're trying to write could be percieved as virus attack, especially with all the efforts going in to avoid spam etc.
    I haven't got Outlook on my home computer but will see what I can dig out of my book.

    From the first bit of code above I easily managed to get Word up and running so opening whichever Application you choose to substitute the "xxx" should work fine.

  16. #16
    Registered User
    Join Date
    05-02-2006
    Posts
    80

    What my book says

    Is this infringing copyright?? I dunno... anyway its extracted from "Excel 2003 , VBA Programer's Reference" by Paul T Kimmel et al, published by WROX.
    This book taught me all I know (apart from the stuff I've picked up from this mesage board). I reccommend it to anyone.

    Please Login or Register  to view this content.
    Give it a go and change the bits you need to reference your data. This is a latebinding model, when they werre trying anything early-binding Norton Anti-Virus cleared it from the cmoputer whenever it was saved.

    Also here's the bit about viruses

    SendEMail has input parameters for the e-mail address of the recipient and the filename of the
    attachment for the e-mail. If your Outlook configuration requires you to logon, you will need to
    uncomment the lines that get a reference to the Namespace and supply the username and password.
    A new mail item is created using the CreateItem method. Text is added for the subject line and the
    body of the e-mail and the recipient and attachment are specified. The Send method sends the
    e-mail.
    You will need to respond to three dialog boxes when executing this code in Office XP. The first two warn
    you that Outlook is being accessed and the second forces a five second delay and warns you that a
    program is sending an e-mail. The techniques you are using, while being very useful to achieve legitimate
    ends, are also, obviously, employed by virus writers.
    While Office 2003 has strong protection against e-mail viruses, earlier versions of Office are more
    vulnerable. Patches are available from Microsoft to add protection to earlier versions of Outlook, but they
    might make it impossible to send e-mail programmatically. It can be very difficult to allow the legitimate
    use of programmatically generated e-mail and prevent viruses doing the same thing. The best answer is
    to have the latest virus protection software installed and keep it up-to-date.
    Well, hope this helps you.

  17. #17
    Registered User
    Join Date
    05-02-2006
    Posts
    80

    There must be in answer on this page somewehre.

    Hi again,

    Stumbled across this when lookign for something else and thought of you. Check it out.
    [link]
    http://www.rondebruin.nl/sendmail.htm
    [/link]

    Tris

  18. #18
    Registered User Ivan F Moala's Avatar
    Join Date
    10-25-2003
    Location
    Auckland, New Zealand
    Posts
    71
    Quote Originally Posted by Pyrex238
    Well, I read into it a bit, and it appears I don't know enough about VBA to do this unfortunately. The code supplied doesn't seem to work for me. I did create a late binding code set and ran it, however it states that it isn't supported... so not sure what the hell is going on.. The code itself looks pretty simplistic, however it just doesn't work for me and I can't figure it out.

    Please Login or Register  to view this content.
    The code worked for me using To.
    using Xl2003 + Outlook2003
    You don't mention what does not work.
    Note: security warning does pop up
    Kind Regards,
    Ivan F Moala From the City of Sails
    \1

  19. #19
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Quote Originally Posted by Ivan F Moala
    The code worked for me using To.
    using Xl2003 + Outlook2003
    You don't mention what does not work.
    Note: security warning does pop up
    it's nice to know the code I edited does actually work... too bad not for me!


    It's possible the administrators have disabled OLE on my system for security... there's really no way to tell since I have the library enabled and functioning in office.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1