+ Reply to Thread
Results 1 to 2 of 2

Prevent button sending e mail and prevent closure of spreadsheet

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    Northampton
    MS-Off Ver
    Excel 2010
    Posts
    40

    Prevent button sending e mail and prevent closure of spreadsheet

    Good afternoon,
    I am having problems with the code. I am trying to send an automatic email in PDF format only after the 4 boxes are filled in, disable the button until all 4 are completed. It seems the Msg box appears to advise to fill in the boxes but sends the email anyway. I am also trying to prevent the sheet from being closed down by some unknown person? I would like to disable the X box in the top right hand corner to try and prevent the sheet from being closed and a message box with Cannot close this sheet!. I am not sure where to start with this stop closure piece of code? Your help would be really appreciated. Thank you
    Robbosan


    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Prevent button sending e mail and prevent closure of spreadsheet

    Checking message text to determine if there are still boxes to be filled in is a bit clumsy and may not be totally reliable. It would be much better to directly check the boxes themselves. It would also help if you format your code according to the control structure. It is a bit difficult to read.

    You have a problem with your Sub naming. You have sub

    Private Sub Worksheet_Change(ByVal Target As Range)

    and also

    Private Sub Workshet_Change(ByVal Target As Range)

    The second one will never run because the name is misspelled. Even if it were spelled correctly, you cannot have two Subs with the same name. So you have to combine these.

    I cannot test this without your file. Please attach your file for a more thorough answer.
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Prevent Mail Merge template from opening
    By ashleyg-2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2014, 05:57 AM
  2. Macro to prevent sending email (attachment) unless specific cells are populated
    By StartRunMSPaint in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-19-2013, 01:51 PM
  3. Outlook - prevent sending of emails without a subject matter
    By ErnieLaboy in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 01-04-2013, 12:40 PM
  4. Prevent Sending eMail from Excel
    By GJL65 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2011, 02:47 PM
  5. How to prevent the closure of a UserForm
    By Romoluzzi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2011, 01:22 PM
  6. [SOLVED] Can I prevent Outlook from sending duplicate emails
    By joe41 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 06-09-2009, 07:18 AM

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