Use VBA to remove Signature or Get it to stop error message on save

austin397

New Member
Joined
Dec 16, 2016
Messages
36
I have created an excel that is to be used as a template for my co-workers. I created a digital signature that is installed on all of the other computers that will be using the excel. I used a signature because I don't want to have every set their macro security to always allow the macros to run. That way if they were to download an excel file that contains harmful code it will not just automatically run.

The problem as I have discovered is that one of the macro's deletes a sheet and causes the error message when the user attempts to save the document, "You have modified a signed project. You do not have the right key to sign this project. The signature will be discarded." [FONT=Arial, Helvetica, sans-serif]Button: "Save changes and discard signature" Button: "Cancel Save".[/FONT]

[FONT=Arial, Helvetica, sans-serif]The sheet that is being deleted does not contain code on it. However, one of the macro codes check to see if this sheet exists. Could that be causing the error?[/FONT]

[FONT=Arial, Helvetica, sans-serif]After the user saves and the file is no longer a template, it doesn't need the signature anymore since it doesn't contain code that will run when the file is not "Read Only".

Is there a way to either remove my digital signature using VBA or a VBA to auto-select the button "Save changes and discard signature"?

If more detail is needed let me know!

Thank you in advance!
[/FONT]
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try saving the new workbook as a "Macro free workbook" (.xlsx). This should eliminate the check to sign it again, in a sane world. No promises that this world is sane.
 
Upvote 0
Thank you for the reply HackSlash,

Unfortunately I don't think this solution will work for me since as soon as I hit save it pops up before giving me the saveas dialog box.
 
Upvote 0
The world of Microsoft is never sane. I suppose you could make a save macro that suppresses warnings and forces it in to a macro-free workbook:

Code:
Application.DisplayAlerts = False
Application.EnableEvents = False
ActiveWorkbook.SaveAs Filename:="NewFile.xlsx" FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
Application.EnableEvents = True
 
Upvote 0
Thank you for your answer,

I did something similar to this to get my results. The end results was putting the excel into .xlsx format and that did stop the error message that was appearing. Thank you for your help!

For anyone in the future who finds this thread, the way I did my save as was to open the Save As dialogue box with a file name specified based on a userform I had created. Here is the code I used.

Code:
    Application.DisplayAlerts = False    Work_Saved = Application.Dialogs(xlDialogSaveAs).Show(File_Name, 51)
    Application.DisplayAlerts = True

The 51 is how excel reads the format.

51 = xlOpenXMLWorkbook (without macro's in 2007-2016, xlsx)
52 = xlOpenXMLWorkbookMacroEnabled (with or without macro's in 2007-2016, xlsm)
50 = xlExcel12 (Excel Binary Workbook in 2007-2016 with or without macro's, xlsb)
56 = xlExcel8 (97-2003 format in Excel 2007-2016, xls)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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