Error sending email from Excel macro


Well-known Member
Jan 26, 2005
I’m getting the error message Run-time error '-2147024770 (8007007e)' on the highlighted line of my code. This only happens on one computer. Other computers running the same macro work fine.
[FONT=Courier New]Sub Send_Request(RowNumber As Long)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>[/FONT]
[FONT=Courier New]<o:p></o:p>[/FONT]
[FONT=Courier New]Dim OutApp As Object<o:p></o:p>[/FONT]
[FONT=Courier New]Dim OutMail As Object<o:p></o:p>[/FONT]
[FONT=Courier New]Dim Message As String<o:p></o:p>[/FONT]
[FONT=Courier New]Dim SecurityDept As String<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p></o:p>[/FONT]
[FONT=Courier New]Application.DisplayAlerts = False<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p></o:p>[/FONT]
[FONT=Courier New][COLOR=red]Set OutApp = CreateObject("Outlook.Application")[/COLOR][/FONT]
[FONT=Courier New]OutApp.Session.Logon<o:p></o:p>[/FONT]
[FONT=Courier New]Set OutMail = OutApp.CreateItem(0)<o:p></o:p>[/FONT]
[FONT=Courier New]Message = Compose_Message(RowNumber)<o:p></o:p>[/FONT]
[FONT=Courier New]With OutMail<o:p></o:p>[/FONT]
[FONT=Courier New]  .To = Cells(RowNumber, 25) & ""<o:p></o:p>[/FONT]
[FONT=Courier New]  If Cells(RowNumber, 28) >= 2 Then<o:p></o:p>[/FONT]
[FONT=Courier New]    .cc = SecurityDept<o:p></o:p>[/FONT]
[FONT=Courier New]  Else: .cc = ""<o:p></o:p>[/FONT]
[FONT=Courier New]  End If<o:p></o:p>[/FONT]
[FONT=Courier New]  .Subject = _<o:p></o:p>[/FONT]
[FONT=Courier New]    "Account ending in " & Right(Cells(RowNumber, 1), 4) & _<o:p></o:p>[/FONT]
[FONT=Courier New]    " opened/revised on " & Cells(RowNumber, 2)<o:p></o:p>[/FONT]
[FONT=Courier New]  .Body = Message<o:p></o:p>[/FONT]
[FONT=Courier New]  .Display<o:p></o:p>[/FONT]
[FONT=Courier New]'    .Send<o:p></o:p>[/FONT]
[FONT=Courier New]End With<o:p></o:p>[/FONT]
[FONT=Courier New]On Error GoTo 0<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p></o:p>[/FONT]
[FONT=Courier New]Set OutMail = Nothing<o:p></o:p>[/FONT]
[FONT=Courier New]Set OutApp = Nothing<o:p></o:p>[/FONT]
[FONT=Courier New]Application.DisplayAlerts = True<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p></o:p>[/FONT]
[FONT=Courier New]End Sub<o:p></o:p>[/FONT]
From what I can figure out, I need to re-register a dll or some other file, but I don't have any idea where to start. How do I find out what file needs to be re-registered on that computer?
Last edited:

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.


Well-known Member
Jan 26, 2005
It took this long for me to get an opportunity to test the suggestion in the link, but it worked perfectly.

Since that link took forever to wade through, I'm reposting just the part of it that helped me:
If you get an error from a code statement like this:

Set ol = CreateObject("Outlook.Application")

the cause may be an anti-virus program on your computer that has a feature to block Outlook scripting. The solution is to turn off the script blocking feature.

If you're using Symantec Anti Virus, make a backup of the Windows registry, and then see if these changes solve the problem:

1. Go to the HKEY_CLASSES_ROOT\Outlook.Application\CLSID key and note the (Default) value. It will be a GUID, most likely {0006F03A-0000-0000-C000-000000000046}.

2. Now go to the key HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InprocServer32 key, using the value from Step 1 if it's different from that shown above.

3. For the (Default) for that key, you should see this value:

C:\Program Files\Common Files\Symantec Shared\Script Blocking\ScrBlock.dll

Delete that text, so that the key's (Default) value becomes (value not set)

Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...