+ Reply to Thread
Results 1 to 5 of 5

Use of SaveAsUI

  1. #1
    Otto Moehrbach
    Guest

    Use of SaveAsUI

    Excel 2003, WinXP
    I need some educating. How do you use the SaveAsUI variable in the macro:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    Boolean)
    Thanks for your help. Otto



  2. #2
    Dave Peterson
    Guest

    Re: Use of SaveAsUI

    It's used to check to see if the user is seeing that File|SaveAs dialog.

    Option Explicit
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If SaveAsUI = True Then
    MsgBox "user is seeing the SaveAs dialog"
    Else
    MsgBox "user is not seeing that box"
    End If
    End Sub

    Not seeing the dialog could mean that the user hit the save, a macro ran save
    (or saveAs).

    (UI = UserInterface = manually)


    Otto Moehrbach wrote:
    >
    > Excel 2003, WinXP
    > I need some educating. How do you use the SaveAsUI variable in the macro:
    > Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    > Boolean)
    > Thanks for your help. Otto


    --

    Dave Peterson

  3. #3
    Otto Moehrbach
    Guest

    Re: Use of SaveAsUI

    Dave
    Please look at this macro. The intent is to Cancel the Save command,
    make some checks, then save the file if the checks are good.
    As written, the message box gives me a True if I hit SaveAs and a False
    if I hit Save. And that's what you said it would do. But in neither case
    does the SaveAs dialog box appear. Am I missing something? Thanks for your
    help. Otto
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    Boolean)
    MsgBox SaveAsUI
    Cancel = True
    Call ChkCells
    If CancelA = False Then
    Application.EnableEvents = False
    ThisWorkbook.Save
    ThisWorkbook.Saved = True
    Application.EnableEvents = True
    End If
    End Sub
    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > It's used to check to see if the user is seeing that File|SaveAs dialog.
    >
    > Option Explicit
    > Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    > Boolean)
    > If SaveAsUI = True Then
    > MsgBox "user is seeing the SaveAs dialog"
    > Else
    > MsgBox "user is not seeing that box"
    > End If
    > End Sub
    >
    > Not seeing the dialog could mean that the user hit the save, a macro ran
    > save
    > (or saveAs).
    >
    > (UI = UserInterface = manually)
    >
    >
    > Otto Moehrbach wrote:
    >>
    >> Excel 2003, WinXP
    >> I need some educating. How do you use the SaveAsUI variable in the
    >> macro:
    >> Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    >> Boolean)
    >> Thanks for your help. Otto

    >
    > --
    >
    > Dave Peterson




  4. #4
    Dave Peterson
    Guest

    Re: Use of SaveAsUI

    Cancel = true
    stops the SaveAs--so you never see the dialog, but your code does its own save
    (under certain conditions).




    Otto Moehrbach wrote:
    >
    > Dave
    > Please look at this macro. The intent is to Cancel the Save command,
    > make some checks, then save the file if the checks are good.
    > As written, the message box gives me a True if I hit SaveAs and a False
    > if I hit Save. And that's what you said it would do. But in neither case
    > does the SaveAs dialog box appear. Am I missing something? Thanks for your
    > help. Otto
    > Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    > Boolean)
    > MsgBox SaveAsUI
    > Cancel = True
    > Call ChkCells
    > If CancelA = False Then
    > Application.EnableEvents = False
    > ThisWorkbook.Save
    > ThisWorkbook.Saved = True
    > Application.EnableEvents = True
    > End If
    > End Sub
    > "Dave Peterson" <[email protected]> wrote in message
    > news:[email protected]...
    > > It's used to check to see if the user is seeing that File|SaveAs dialog.
    > >
    > > Option Explicit
    > > Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    > > Boolean)
    > > If SaveAsUI = True Then
    > > MsgBox "user is seeing the SaveAs dialog"
    > > Else
    > > MsgBox "user is not seeing that box"
    > > End If
    > > End Sub
    > >
    > > Not seeing the dialog could mean that the user hit the save, a macro ran
    > > save
    > > (or saveAs).
    > >
    > > (UI = UserInterface = manually)
    > >
    > >
    > > Otto Moehrbach wrote:
    > >>
    > >> Excel 2003, WinXP
    > >> I need some educating. How do you use the SaveAsUI variable in the
    > >> macro:
    > >> Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    > >> Boolean)
    > >> Thanks for your help. Otto

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  5. #5
    Otto Moehrbach
    Guest

    Re: Use of SaveAsUI

    Thanks Dave. I have it straight now. Otto
    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > Cancel = true
    > stops the SaveAs--so you never see the dialog, but your code does its own
    > save
    > (under certain conditions).
    >
    >
    >
    >
    > Otto Moehrbach wrote:
    >>
    >> Dave
    >> Please look at this macro. The intent is to Cancel the Save command,
    >> make some checks, then save the file if the checks are good.
    >> As written, the message box gives me a True if I hit SaveAs and a
    >> False
    >> if I hit Save. And that's what you said it would do. But in neither
    >> case
    >> does the SaveAs dialog box appear. Am I missing something? Thanks for
    >> your
    >> help. Otto
    >> Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    >> Boolean)
    >> MsgBox SaveAsUI
    >> Cancel = True
    >> Call ChkCells
    >> If CancelA = False Then
    >> Application.EnableEvents = False
    >> ThisWorkbook.Save
    >> ThisWorkbook.Saved = True
    >> Application.EnableEvents = True
    >> End If
    >> End Sub
    >> "Dave Peterson" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > It's used to check to see if the user is seeing that File|SaveAs
    >> > dialog.
    >> >
    >> > Option Explicit
    >> > Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    >> > Boolean)
    >> > If SaveAsUI = True Then
    >> > MsgBox "user is seeing the SaveAs dialog"
    >> > Else
    >> > MsgBox "user is not seeing that box"
    >> > End If
    >> > End Sub
    >> >
    >> > Not seeing the dialog could mean that the user hit the save, a macro
    >> > ran
    >> > save
    >> > (or saveAs).
    >> >
    >> > (UI = UserInterface = manually)
    >> >
    >> >
    >> > Otto Moehrbach wrote:
    >> >>
    >> >> Excel 2003, WinXP
    >> >> I need some educating. How do you use the SaveAsUI variable in the
    >> >> macro:
    >> >> Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    >> >> Boolean)
    >> >> Thanks for your help. Otto
    >> >
    >> > --
    >> >
    >> > Dave Peterson

    >
    > --
    >
    > Dave Peterson




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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