Results 1 to 13 of 13

Thread: BeforeSave and Userform: Issues with saving the excel file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Dec 2019
    Posts
    9
    Location

    BeforeSave and Userform: Issues with saving the excel file

    Hi! I am trying to capture and save comments when the user tries to save the excel through a BeforeSave function and user form. The code works fine but it saves the excel even if user cancels the userform. Here are the codes:

    The BeforeSave code:

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Comments_form.Show
    If Comments_form.Cancel = True Then Cancel = True
    End Sub



    The Userform code w.r.t. cancel click is:



    Private Sub Cancel_Click()

    Comments_form.Hide
    End Sub
    Last edited by sgre; 12-04-2019 at 03:17 PM.

Posting Permissions

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