Corey C
Corey C

Reputation: 1

VBA Update Link using UNC server path not working

I have a spreadsheet with a macro to update linked data and do some other things as well to this data (filtering and sorting). The first thing it does is to update the linked data. The macro works using a mapped network drive. The macro does not work using UNC path. See code below for examples. If another user runs the macro with the mapped drive then they get asked where the file is. I'm trying to make things as simple as possible for them.

I have verified that the UNC path is correct. It works when i past it into explorer. The linked file under connections is linked using the mapped drive. I have tried to change it to a UNC path but it fails every time but freezing. I have let it sit more than 30 minutes. These two files are in different folders but in the same server. They are both in \server.server.company\officelocation\dept, just in different departments.

This works:

ActiveWorkbook.UpdateLink Name:= _
"Y:\group\projects\subfolder\myexcelfile.xlsm", Type:=xlExcelLinks

This doesn't:

ActiveWorkbook.UpdateLink Name:= _      "\\server.server.company\officelocation\dept\division\group\projects\subfolder\myexcelfile.xlsm", Type:=xlExcelLinks

The error is

run-time error '1004': Method 'UpdateLink' of object' _Workbook' failed

Any suggestions would be greatly appreciated.

Upvotes: 0

Views: 462

Answers (1)

Corey C
Corey C

Reputation: 1

Think I finally figured it out. Some of the formulas used the mapped drive. When i switched it to UNC path then the macro works with UNC pathing.

Upvotes: 0

Related Questions