Silently save digitally signed message to disk

Posted on 2015-01-13
Last Modified: 2015-01-28
I am using  vba in outlook 2010

When I try to save a digitally signed message to disk, outlook sends a warning message.

You have changed this message. If you save the changes, the message will no longer be digitally signed. Do you want to save your changes?

I want to save the message to disk without any changes. How can I do that?

Dim item As mailItem
    For Each item In ActiveExplorer.Selection
        item.SaveAs "c:\aatmp\test642.msg", olMsg
End Sub

Open in new window

Question by:rberke
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 15

Expert Comment

ID: 40548026
I think you would have to close the file then copy it to your preferred location... saving, as I understand it, will save changes.  You can, perhaps, make use of close without saving, or write the content of the file to another location.

I think the approach I would use depends on whether or not it is important to retain the certificate.

Author Comment

ID: 40548186
I am saving the contents of my email archive to disk.

99% of the saves work fine, but the program fails when the archive contains a digitally signed email.

As a workaround, i log the troublesome emails, and skip them.

Any body have code that will get around the problem?

Everything I try keeps coming up with "you have changed the message ...".

Accepted Solution

rberke earned 0 total points
ID: 40549518
the problem occurred when a client sent me a digitally signed email. Until this happened, I had never had any interaction with digital signed emails.

But, I decided to get a little experience, so I went to and installed a free digital signature on my computer and changed the outlook configuration to allow me to sign my own messages.

Strangely enough, the .saveas problem has now gone away  !!! I am able to save the message to disk with no problem.

I believe the change to outlook configuration allowed the code to work.

Perhaps one of you experts can test this for me.

open the attached zip, and copy the .msg file into outlook.  Select that message and run the code in my initial post.

If the code gives you the warning message, I'll give you a share of the points.
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

LVL 15

Assisted Solution

DrTribos earned 500 total points
ID: 40549907
Hmmm interesting... I have not used VBA in OutLook before so decided to dip my big toe in...

I get RTE -2147287037 (80030003) The operation failed.

I did not have a dir with the name specified so I just used c:\tmp instead, then it worked

The macro ran w/o issues.

I have confirmed that the message was copied to the tmp folder.  I will disclose that I already had my own digital signature for code signing (GoDaddy) - however I don't use outlook and can guarantee that I have not changed any outlook specific settings on this PC to work with signatures (MS Word is a different story and that could impact all of Office).

Hope this helps.

Option Explicit

Sub Robert()
Dim item As MailItem
    For Each item In ActiveExplorer.Selection
        item.SaveAs "c:\tmp\test642.msg", olMSG
End Sub

Open in new window


Author Comment

ID: 40550191
Thanks for your input.

Summary so far:
1) my laptop uses Outlook 2010 and originally gave the error message
2) after installing a signature and reconfiguring Outlook, the error message went away.
3) A desktop computer with outlook 2003, no signatures and no reconfigurations does give the error message.
4) I will install a signature on that computer and see what happens. That will be definitive, but it might be a day or two before I get around to it.

DrTribos recent post adds the following
5) DrTribos has a computer with signatures installed, His does not give the error message even though Outlook has not be reconfigured.

LVL 15

Expert Comment

ID: 40550210
No worries, I don't think I can add much more as I don't really have suitable test environments. But the behavior you describe seems odd to me! Nothing new, just saying!
LVL 15

Expert Comment

ID: 40567729
Thanks, glad you got it working.

Author Closing Comment

ID: 40574821
DrTribos gets points for confirming that my code works on his Windows 7 computer even though it did not work on mine.

But, I "fixed" my Windows 7 computer by installing a first digital email certificate.  That idea was mine, so I am awarding myself the best answer.

In a few months, I will check to see if the "fix" also works on another computer with windows XP, but that computer cannot be touched right now.
LVL 15

Expert Comment

ID: 40574855
Thanks - glad to contribute

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
create different version if file exists 1 44
move line without macro or copy/paste 6 43
sort time order 10 44
multiple unique values in different columns 15 34
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article will show you how to use shortcut menus in the Access run-time environment.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question