Thread: Use of SaveAsUI
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Use of SaveAsUI

Thanks Dave. I have it straight now. Otto
"Dave Peterson" wrote in message
...
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" wrote in message
...
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