+ Reply to Thread
Results 1 to 11 of 11

macro creating email using outlook express

  1. #1
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85

    macro creating email using outlook express

    I am trying to use a macro to email a recipient. I only want the active sheet in a workbook to be sent. I am using outlook express. Help is appreciated.

  2. #2
    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 Khaos176,

    To do this it would be better if you have Outlook. However an attachment can be sent using Outlook Express with some rather complicated code. You have to supply the email address, subject, and message (body) to the macro from VBA.
    Please Login or Register  to view this content.
    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85
    I am using code written by Leith Ross. It works fine in Outlook 2003 but I need it to use outlook express. I replace the "Outlook .Application" with "MSIMN.Application" but it does not work.


    'Written: October 18, 2008
    'Author: Leith Ross
    'Summary: Send active worksheet as an attached file.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 10-30-2008 at 03:38 PM. Reason: Added code tags

  4. #4
    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 Khaos176,

    Your solution has been posted.

    Sincerely,
    Leith Ross

  5. #5
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85
    Sorry about the last post. I was typing it while you were sending

  6. #6
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85
    I cant seem to figure out how i would run this macro

  7. #7
    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 Khaos176,

    You have to run it from another macro. Where is the information on the worksheet? I can change the macro to use those cells. You can then attach the macro to a button or use ALT+F8 to run it.

    Sincerely,
    Leith Ross

  8. #8
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85
    I tried to add this code to a command button. It gives me a compile error "Only comments may appear after End Sub, End Function, or End Property". If this helps the cells that I am using for the email are located in the following - Recipient = CoverSheet C11 (This is the worksheet I would like to send), Subject = ("DataStorage!P6"). Also the recipient is only a name, I want Outlook to find the correct email address in the address book for the contact. Thank you so much!

  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 Khaos176,

    Although Outlook Express has an address book, the application doesn't allow VBA to access it. Outlook does allow VBA to access the address book and can even resolve names. Why are you not wanting do this Outlook? If you have Office you have Outlook. If you are concerned that the recipients won't be able to receive it, they will. Your email is plain text. All email programs handle plain text.

    Sincerely,
    Leith Ross

  10. #10
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85
    I am using express only because that is what my company is using. So in trying to keep it simple for them i am trying to get this to work. I might talk them into switching if needed. The problem i am having is that when I press ALT F8 to go to the macros the macro is not there. I dont understand what i need to do to run it.

  11. #11
    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 Khaos176,

    You're right to keep it simple. If your company is using Outlook Express then that is what we will have to use. I will rework the macro to launch Outlook Express. Currently, it launches whatever you computer system's default email client is set to. I will write so that the active sheet is emailed when you run the macro from ALT+F8 or a button, etc.

    Sincerely,
    Leith Ross

+ 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