Results 1 to 12 of 12

Workbook BeforeSave Event causing workbook to close

Threaded View

  1. #1
    Registered User
    Join Date
    06-26-2014
    Location
    Christchurch, New Zealand
    MS-Off Ver
    2010
    Posts
    43

    Talking Workbook BeforeSave Event causing workbook to close

    Hi

    I'm trying to create a workbook which users update then send via a separate command button to the 'data collector'. I'm trying to build in that they can't save the workbook, only the 'data collector' can.
    I've added in the below event but when the user clicks OK on the message box the workbook closes, what I'd like it to do is when OK is clicked the user returns back to the workbook so they can 'click the send button'.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If Environ("Username") <> "jrussell" Then
     Cancel = True
     MsgBox "You cannot save this form, click the Send button instead"
    End If
    End Sub
    Can anyone see where I'm going wrong?

    Thanks!
    Last edited by Jo2710; 09-17-2014 at 10:35 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem with Save & Close macro and beforeSave event
    By Danny_ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-18-2013, 04:32 PM
  2. Workbook before close event
    By solnajeff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2007, 08:51 AM
  3. Workbook close event
    By kpriyac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-18-2006, 02:25 PM
  4. [SOLVED] Excel WorkBook Close Event
    By Xcelion in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2006, 11:35 AM

Tags for this Thread

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