View Single Post
  #3   Report Post  
BDAvs BDAvs is offline
Junior Member
 
Posts: 13
Default

Quote:
Originally Posted by GS[_2_] View Post
I'm working in Excel 2010. I'd like users of this particular
spreadsheet to be able to 'Save as PDF', but I do not want users to
be able to use 'Save' or 'Save as'.

Is there a code for this?

Thanks in advance for any help.

BD


You can use the Workbook_BeforeSave event to 'trap' people trying to
use Save/SaveAs, set Cancel=True, then use the ExportAsFixedFormat
method for the worksheet/workbook as suits your need. Easiest way to
get code for this is to go through the steps manually while the macro
recorder is running, clean up the 'junk' that the recorder so
generously donates, and put code in the Workbook_BeforeSave event to
'Call' the macro.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

This is the code I am currently using:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "Saving this workbook has been disabled."
Cancel = NoSave
End Sub

When I hit save, the message box appears, but after I hit 'Ok' the save as or save as PDF box appears. I only want users to be able to save as a PDF. Any ideas on a code?

Thanks,

BD