View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GTVT06 GTVT06 is offline
external usenet poster
 
Posts: 141
Default having trouble disabling "save", "save as" (2003)

On Jan 23, 11:08*am, "dman" wrote:
Hi.

I have a workbook that I do not want the user to be able to save or save as.
The code I have disables the proper icons, however, when I start Excel up
again
with a different workbook, the icons are still disabled.

If I remove the .application, I get object var or with block var not set.
How do I
disable the save/save as for only the workbook I need? Here is my code int
he the
Workbook_Open sub.

* ThisWorkbook.Application.CommandBars("Worksheet menu bar").Controls _
* * * * * ("&file").Controls("&Save").Enabled = False

* ThisWorkbook.CommandBars("Worksheet menu bar").Controls _
* * * * * ("&file").Controls("&Save").Enabled = False

Help. Thanks.


Try re-enableing it before the workbook closes. add the code below:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Application.CommandBars("Worksheet menu bar").Controls
_
("&file").Controls("&Save").Enabled = True


ThisWorkbook.CommandBars("Worksheet menu bar").Controls _
("&file").Controls("&Save").Enabled = True

End Sub