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]
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

HackSlash

Active Member
Joined
Nov 18, 2016
Messages
360
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.
 

austin397

New Member
Joined
Dec 16, 2016
Messages
36
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.
 

HackSlash

Active Member
Joined
Nov 18, 2016
Messages
360
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
 

austin397

New Member
Joined
Dec 16, 2016
Messages
36
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:

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,542
Messages
5,511,938
Members
408,869
Latest member
MM005

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top