+ Reply to Thread
Results 1 to 14 of 14

Macro works - just need to send result to Excel and not MsgBox

  1. #1
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Macro works - just need to send result to Excel and not MsgBox

    Hi all,

    With the wonders of the web I've managed to cobble the below code which successfully tells me how many emails are in a particular folder. However the result is displayed in a message box. I really want to send the result to an Excel sheet that has the following details:

    Name: 'CountofEmails'
    Location: C:\Documents and Settings\My Documents\Downloads

    Can anyone help?

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Macro works - just need to send result to Excel and not MsgBox

    you want the name of the file to be "how many emails exist"?
    ~~LaffyAffy13~~

    If I have helped you solve your problem, please be sure to click at the bottom left of my post.

    Thanks.

  3. #3
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Macro works - just need to send result to Excel and not MsgBox

    Hi Laffy,

    Yes that's fine. Thank you very much!


  4. #4
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Macro works - just need to send result to Excel and not MsgBox

    or do you want to to literally be called "Count of Emails"

  5. #5
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Macro works - just need to send result to Excel and not MsgBox

    Hi Laffy,

    'Count of Emails' will suffice.

  6. #6
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Macro works - just need to send result to Excel and not MsgBox

    Is that a file already created on your computer that you want to open and replace old data with, or are you looking for something that will delete the file and then recreate it every time?

  7. #7
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Macro works - just need to send result to Excel and not MsgBox

    Hi Laffy,

    Yes that's a very good point. The file already exists and would need overwriting each time (keeping the same filename)

  8. #8
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Macro works - just need to send result to Excel and not MsgBox

    Ok well this deletes the file and then creates it again.
    Please Login or Register  to view this content.
    And this one just opens the file up and edits it. Let me know if something doesn't work properly.

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Macro works - just need to send result to Excel and not MsgBox

    Hi Laffy,

    Thanks! I tagged the first one on the end of my original code - is this what I am meant to do? I then clicked run and the the word 'Windows' in the below code is highlighted and the following error comes up:

    Please Login or Register  to view this content.

    Compile Error: Sub or Function not defined

  10. #10
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Macro works - just need to send result to Excel and not MsgBox

    Oh, yeah. Here replace the "With" area with this and tell me if it fixes it:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Macro works - just need to send result to Excel and not MsgBox

    Sorry. Still the same thing. This is my complete code at present:

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Macro works - just need to send result to Excel and not MsgBox

    When you get to the error, is there at least a new workbook named "Count_of_Emails"

  13. #13
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Macro works - just need to send result to Excel and not MsgBox

    Yes, i already created it and put it at the loacation

  14. #14
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Macro works - just need to send result to Excel and not MsgBox

    I don't know what the problem is, but I do know that you can just use this code and it will do the job as well.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel 2010 file with VBA save and send code works-but file can't be found.
    By carlton.clay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2013, 09:46 AM
  2. Send Email with MsgBox vbOk
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-16-2011, 05:44 PM
  3. How to create a msgbox that show sum result of A1-A10 ?
    By yannipr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-16-2008, 06:37 AM
  4. Macro - msgbox vs. enter result in a cell??/
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2006, 08:09 PM
  5. This msgbox code works when in Auto_open, but not when called.
    By StargateFanFromWork in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-24-2005, 12:25 PM

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