Results 1 to 5 of 5

Before Save Force closes

Threaded View

  1. #1
    Registered User
    Join Date
    08-13-2014
    Location
    Mexico
    MS-Off Ver
    15
    Posts
    3

    Question Before Save Force closes

    Greetings!
    I'm facing a force close when saving a workbook with this code
     Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    
    Dim bFileSaveAs As Boolean
    
    
    
    If ActiveWorkbook.Name Like "Template*" Then
    
    
        bFileSaveAs = Application.Dialogs(xlDialogSaveAs).Show
        On Error Resume Next
        If Not bFileSaveAs Then MsgBox "Remember, save Report generated in a different archive if it is the first time", vbExclamation, "Leave template clean for use"
    
    End If
    
    End Sub
    I want to keep the template clean and let the user only save copies -when trying to save-
    It's a macro enabled workbook, I want them to be available to run the macros but when they try to save only let them save in a new workbook.
    This code kind of does the trick, however, when it saves the workbook excel stops working.
    Last edited by sgdva; 11-24-2014 at 11:59 AM. Reason: Wrong Format

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Save and exit workbook when user form closes
    By savio21 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2011, 11:21 AM
  2. Excel closes down when trying to save a file
    By Rob.P in forum Excel General
    Replies: 0
    Last Post: 07-23-2010, 04:30 AM
  3. Excel File Fails/Closes When I Save
    By buddhajb in forum Excel General
    Replies: 1
    Last Post: 03-07-2008, 06:26 AM
  4. File closes without prompting to save
    By freyabeads in forum Excel General
    Replies: 0
    Last Post: 03-01-2006, 09:10 AM
  5. calculation - prompting to save when file closes
    By lpj in forum Excel General
    Replies: 0
    Last Post: 02-14-2006, 04:30 PM

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