1

I have an Outlook function that, as of Friday the 3rd May 2019 has started throwing the following error:

Run-time error '-2147417851 (80010105)':  
Method 'Open' of object "Workbooks' failed  

This is the code up to the error point:

Sub CreateDictionary()
Dim start
Dim finish

start = Timer
Dim path As String

'***---Declarations---***
Dim MyEmail As Object
Dim xl As New Excel.Application
Dim wb As Excel.Workbook
Dim Sheet As Excel.Worksheet
Dim ExcelFileName As String
Dim j As Integer
Dim jMax As Variant
Dim entry As String

'***---Set Required Variables---***
ExcelFileName = "\\HYPER\CURRENT JOBS\USEFUL STUFF\Active Jobs DB.xlsm"
Set wb = xl.Workbooks.Open(ExcelFileName, 0, True)

I have checked the filename and it is fine. I have double checked my entries in the xl.Workbooks.Open command and nothing changes. I have read elsewhere that this is a Windows 10 issue, though I could not find any guidance to fixing the issue.

Has anyone here had a similar problem?

EDIT: I have created a temporary workaround by opening the required workbook and using the following code:

On Error Resume Next
Set wb = GetObject("\\HYPER\CURRENT JOBS\USEFUL STUFF\Active Jobs DB.xlsm")

If Err <> 0 Then
    MsgBox ("Please open Active Jobs Database and try again")
    Exit Sub
End If

On Error GoTo 0

It is currently working but it is obviously not as streamlined as my previous code. If anyone can find out why this is happening, I would greatly appreciate it!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Dan W
  • 133
  • 1
  • 13
  • If you cut/paste the file name, go to Excel, Use File->Open->Browse and Paste the file name to the File name-box: Can you open the file? – FunThomas May 06 '19 at 07:03
  • Does it work if you change the ExcelFileName variable to point to a local file? – Dmitry Streblechenko May 06 '19 at 15:27
  • https://stackoverflow.com/a/41801050 – 0m3r May 06 '19 at 15:33
  • @FunThomas Yes that still works. – Dan W May 07 '19 at 05:40
  • @dmitry Streblechenko no that doesn't work. – Dan W May 07 '19 at 05:41
  • @0m3r I tried the options in that but it still gives the same error. – Dan W May 07 '19 at 05:44
  • Which office are you on? 64 or 32 version - 2016..... – 0m3r May 07 '19 at 06:09
  • @0m3r Office 2010 32bit (Version 14.0.7232.5000) – Dan W May 07 '19 at 07:23
  • Try one more thing , rename the file with out spaces- use one word name – 0m3r May 07 '19 at 08:47
  • @0m3r I tried that when I tested if a local file works - filename was "Book1.xlsx". I have been looking at it a bit more today, and it appears to open an instance of Excel, but then throws an error before it opens properly. When I close the instances of excel in task manager, then open excel I get the "Recovered Documents" pane on the right full of instances of the document that never opened properly. I use this code everyday so its super frustrating! – Dan W May 07 '19 at 08:57
  • I just edited the original post with a temporary workaround – Dan W May 08 '19 at 01:12

0 Answers0