Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2004
    Location
    Sacramento, California, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sendmail for Excel (Excel 2003)

    I have found several entries about send mail and used them to create a process that automatically sends mail (I encounter a security 'delay' and must select 'Yes' in answer to whether I want to send for each file), and am impressed. However, while I can step through the process just fine, when I run the Macro, Excel doesn't stop working...its as though there is a loop that isn't closing. I have to use Novell Client to close Excel. After the loop, here is the code I have:

    Loop
    EndLoop:

    Sheets("Filelist").Select
    Columns("A:G").Select
    Selection.Delete Shift:=xlToLeft
    Range("A1").Select
    Sheets("Macro Buttons").Select
    Range("A1").Select
    Application.DisplayAlerts = True
    MsgBox ("The process is complete. This file will now close.")

    ActiveWorkbook.Close

    Seems simple enough. Don't know if its something that comes from the loop. Any ideas?

    thanks in Advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sendmail for Excel (Excel 2003)

    You modify the workbook, then close it. I suppose that Excel displays a message box asking whether you want to save changes. Perhaps this message box is hidden behind another window. It would be better to specify whether you want to save the workbook or not in the code:

    ActiveWorkbook.Close SaveChanges:=True

    or

    ActiveWorkbook.Close SaveChanges:=False

    You can install the free utility ClickYes to suppress the security warnings.

  3. #3
    New Lounger
    Join Date
    Nov 2004
    Location
    Sacramento, California, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sendmail for Excel (Excel 2003)

    Thank you. I didn't have luck with that, but I did some more research. I had, in the loop, the following statement " Application.Interactive = False". I hadn't seen it before, but was trying to get rid of the security message and tried several versions of the 'DisplayAlerts = False', etc. However, for the Application INteractive, I failed to include the 'True' statement, which apparently caused the loop.

    Thanks for all the help.

Posting Permissions

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