Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Disabling Save Upon Exit

I am trying to diable the users ability to save the document upon exit. I
want them to be required to save the file under a different name.

The code works, yet when I put in my .NET application, upon closing the
form, it allows the user to Save instead of Save As.

Here's the code I have below:
Private Sub workbook_open()

'With CommandBars("File")
With Me.Application.CommandBars("File")
..Controls(4).Enabled = False 'Save Button

End With
Me.Application.CommandBars("standard").Controls("S ave").Enabled = False
Application.CommandBars("Worksheet Menu Bar").FindControl _
(ID:=748, Recursive:=True).OnAction = "Macro1"
End Sub



Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Me.Application.CommandBars("File")
.Controls(4).Enabled = True
End With

Me.Application.CommandBars("Standard").Controls("S ave").Enabled = True

strAnswer = MsgBox("Would you like to save the Expense Report?",
vbYesNoCancel)
If strAnswer = vbYes Then
Application.Dialogs(xlDialogSaveAs).Show "C:\New_Expense_Report.xls"
Else
Exit Sub
End If


Application.CommandBars("Worksheet Menu Bar").FindControl _
(ID:=748, Recursive:=True).OnAction = ""

End Sub

Sub Macro1()
Application.Dialogs(xlDialogSaveAs).Show "C:\New_Expense_Report.xls"
End Sub


Any advice would be greatly appreciated!
Thanks,
Elena
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disabling Save Upon Exit


The easiest way to do that is to set application level events, the
intercept the call to the save method and cancel the operation b
setting the cancel property to true. Let me know if you need the cod
to the that

--
cscor
-----------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...fo&userid=2401
View this thread: http://www.excelforum.com/showthread.php?threadid=37633

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Disabling Save Upon Exit

If you could please send that code, it would be fantastic!

Thank you,
Elena

"cscorp" wrote:


The easiest way to do that is to set application level events, then
intercept the call to the save method and cancel the operation by
setting the cancel property to true. Let me know if you need the code
to the that.


--
cscorp
------------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376339


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disabling Save Upon Exit


Elena,

I prepared a spreadsheet with the code so you can see and test the
functionality. The spreadsheet is attached. Let me know if it is what
you need

Best regards

Juan Carlos


--
cscorp
------------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376339

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disabling Save Upon Exit


Elena,

If you save the original file as read only when a password for
modification, the user will be automatically forced to "Save As" to
keep any changes made to the original. Is that what you need?

Thanks.

Juan Carlos


--
cscorp
------------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376339



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Disabling Save Upon Exit

This might be silly question... but how do I get the attachmentment? I can't
seem to find the link.

Thanks again,
Elena

"cscorp" wrote:


Elena,

I prepared a spreadsheet with the code so you can see and test the
functionality. The spreadsheet is attached. Let me know if it is what
you need

Best regards

Juan Carlos


--
cscorp
------------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376339


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disabling Save Upon Exit


Hi..

Just a follow up. Is your problem solved ?

Regards
Juan Carlo

--
cscor
-----------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...fo&userid=2401
View this thread: http://www.excelforum.com/showthread.php?threadid=37633

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling 'Save as web page' StuartP Setting up and Configuration of Excel 0 October 30th 09 12:36 PM
Disabling SaveAs and Save? Petitboeuf Excel Discussion (Misc queries) 7 July 6th 06 05:40 PM
Disabling Save Function TheRobsterUK Excel Discussion (Misc queries) 2 May 31st 05 05:02 PM
Save & Exit Anthony Excel Worksheet Functions 1 February 12th 05 06:23 PM
Disabling Save Pop-Up R. Woltner Excel Programming 0 July 7th 04 12:28 AM


All times are GMT +1. The time now is 07:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"