VBA Runtime Error 5147 - This File Could Not Be Found

Alan_P

Well-known Member
Joined
Jul 8, 2014
Messages
596
Morning Guys,

My attempts at googling this error have been fruitless so any help would be much appreciated!

I have an excel sheet that creates word documents and is used by around 5-6 people, but for some reason for only 1 person they get a runtime error 5147 on the line in red below. He has access to the file that's linked in the cell (he can open it manually).

Code:
If Err.Number <> 0 Then
    Set wdApp = CreateObject("Word.Application")
End If
    
On Error GoTo 0

[COLOR=#ff0000]Set TempDoc = wdApp.Documents.Open(Sheets("Templates").Range("C21").Value)[/COLOR]
wdApp.Visible = True

Many Thanks,
Alan.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi Alan,

That one user might not have the same drive mappings as the other users. You could use a Universal Naming Convention (UNC)file path in that cell if it isn't already in that format.

You could also try having that user record a macro while they open the file manually from within MS Word. The path that is recorded might shed some light on why the macro from Excel isn't working.
 
Upvote 0
Hi Jerry,

Using the UNC path worked a treat! Thank you very much!!

Cheers,
Alan.
 
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,420
Members
452,325
Latest member
BlahQz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top