question

52608327 avatar image
0 Votes"
52608327 asked emilyhua-msft commented

VBA Digital certificate (Selfcert)

I've created and installed a selfcert certificate following the description from Graham Mayor:

http://www.gmayor.com/create_and_employ_a_digital_cert.htm

So far so good, but when I update the project I get the message that I'm changing a signed project and there is no digital certificate available anymore. It has worked for years but now for some weeks, this behaviour occurs.

office-excel-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

emilyhua-msft avatar image
0 Votes"
emilyhua-msft answered emilyhua-msft edited

Hi @52608327

Could you please let us know which version of Office are you using now?

Based on the link that you shared, I test on my environment with Office 2019 (Version 1808 Build 10384 20023) installed, after I modift the VBA code, it is automatically re-signed when I save the workbook.

It has worked for years but now for some weeks.

Have you done any changes for your Office? Such as installing updates.
Does this issue occur with all workbooks include macros?

I would suggest you perform an Online Repair for your Office from Control Panel.
If it does not work, it's recommended create a new local Windows account, then log into this new administrator account to have a check.

Please also make sure the digital certificate that you created is valid and trusted.
189612-capture72.jpg

Besides, please ensure your workbooks are not shared to other people.
If you have run any security software, you can temporarily quit it to have a check.


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




capture72.jpg (60.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

52608327 avatar image
0 Votes"
52608327 answered emilyhua-msft edited

Hi,

189697-test3.png

It looks as there is no private key, I'll create new certificate tomorrow and post the result.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @52608327
Thanks for your response.
To protect your privacy information, I will cover your mail box on the image below.
Any updates, welcome to post back.

0 Votes 0 ·
52608327 avatar image
1 Vote"
52608327 answered

Hi EmilyHua,

My certificate did not have a private key assigned, I don't know if that could be the cause? I found a few self-issued certificates with certmgr and deleted them all. Next, I created a new certificate:
- Private key is OK
- Code signing looks also OK
- I don't get the warning that I've changed a signed project.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

emilyhua-msft avatar image
0 Votes"
emilyhua-msft answered

Hi @52608327

Thanks for your sharing, and I am glad the warning goes away.
It seems that missing private key is what causes the certificate to not work properly.

By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others.", and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

[VBA Digital certificate (Selfcert)]

Issue Symptom:

Signing VBA code with a self-created certificate, but there is a warning after changing the project.

Solution / Workaround:

Created a new certificate, and ensure it has a priavte key.

< Solution provided by 52608327 >


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

52608327 avatar image
0 Votes"
52608327 answered emilyhua-msft commented

Something strange.

The dig cert was again lost in my projects. Looking in MMC, no certificates in personal folder. I recreated it again with the same name and all at once my projects are signed again.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @52608327
Sorry for the delay, as I am not familar with certificates, it's best to post a new thread about losting certificates with the tag "windows-10-general", and then please be patient to wait for the advice from relevant experts.

Thanks for your understanding.


0 Votes 0 ·