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
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
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
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
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
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks