Disable Save and Save As function. Only shape object can be clicked to save

arthmalaca

New Member
Joined
Sep 18, 2016
Messages
5
Hi,

Can you please help me with my problem. I am currently creating a checklist and I need to disable save and save as function. I have a button shape to be clicked to save the file which is still subject to the following considerations:

1. Column B is intended for Processor checks. If the processor filled out the field and click the shape button, a message will pop-out saying "Do you want to save the file. Checker column is blank" if he clicks yes, it will be saved.

2. Column C is intended for Checker checks. If the checker field out the field and click the shape button, if the checks are in incomplete a message will pop-out saying "Data incomplete" and the file cannot be saved until everything is populated.

Can you please give me a code for these? If point 1 & 2 is not possible, then even the disabling of save and save as function will do. I just need to disable it and put the power of saving to the shape button.

Please help me guys. Many thanks.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Two ways that come to mind to achieve waht you want :

1 Method- Using a Boolean Public Property of the Workbook .. Your shape object Macro should then look something like this:

Code:
Sub ShapeMacro()
    ThisWorkbook.SavingFromShape = True
    ThisWorkbook.Save
End Sub

and then your BeforSave event code should look like this :

Code:
Public SavingFromShape As Boolean

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If Not SavingFromShape Then Cancel = True
    SavingFromShape = False: Exit Sub
End Sub


2 Method- Using Application.Caller .. Your BeforeSave evnt code should look like this :

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    On Error Resume Next
        If Application.Caller <> "Rectangle 1" Then Cancel = True: Exit Sub
    On Error GoTo 0
End Sub

Where "Rectangle 1" is the name of the Shape object .. change name to suit.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,166
Messages
6,129,257
Members
449,497
Latest member
The Wamp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top