View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Closing Excel without saving

I've never used the .sendforreview.

Maybe someone who knows how that works will jump in with a tip for you.

But until they do, maybe you could just share the workbook yourself with a line
of code like:

ActiveWorkbook.SaveAs sPath & sFilename & ("_Studybank Application"), _
accessmode:=xlShared

Since it'll be already shared, the user shouldn't have to do anything (not
vigorously tested, though).

Abs wrote:

Hi Dave, it is me again.
I figured out the initial problem, just placing the displayalert code at the
right place, now saves my worksheet okay. However please look at the code
attached, after the Endif statement, when it tries to send for review, it
wants to save a shared version and I cannot make it pick option 'No'. I do
not want to create a shared version. If I deactivate the displayalert, the
code stops for an input from user on the Save As message box.
Sorry about this, but all this is arising from the fact my company uses
Lotus Notes as e-mail. I know Outlook does has this e-mail facility easier
than Lotus Notes.

Private Sub CommandButton1_Click()
Dim Response As String
Dim msg As String
Dim Style As String
Dim sPath As String
Dim sFilename As String
Dim ans

msg = "This workbook will close after saving; Are you sure to proceed?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sPath = "u:\"
sFilename = Range("b26").Value
ans = MsgBox("File will be saved as " & sPath & sFilename &
"_Studybank Application")
Application.Goto Reference:=Worksheets("Page1").Range("f2")
Selection.Value = sFilename & " application"
Application.Goto Reference:=Worksheets("Page1").Range("i2")
Selection.Formula = Now()
Application.Goto Reference:=Worksheets("Page1").Range("a1")
ActiveWorkbook.SaveAs sPath & sFilename & ("_Studybank Application")
Else
MsgBox ("Please save your application")
End If
Application.DisplayAlerts = False
ActiveWorkbook.SendForReview _
Recipients:="; ", _
Subject:=sFilename & "-Studybank Application.", _
ShowMessage:=True, _
IncludeAttachment:=True
ActiveWorkbook.Close savechanges:=False
Endsub


--

Dave Peterson