Error 1004 - Add Hyperlinks to a range with Cell Value in string on Open - Doesn't work when opening in Shared Mode

KeithGargett

New Member
Joined
Sep 2, 2019
Messages
6
Hi,
I have the following piece of code running when opening a workbook.
I want this workbook to be shared, but when I open in shared mode this piece of code gives me a run-time error '1004': Application-defined or object-defined error.

Works fine when not in shared mode. I have googled specific error number but cant work out which bit is causing the error.

Code:
Private Sub Workbook_Open()
    Range("A7").Activate
    Dim cnf
    Dim dir As String
    Dim fnsh As Long
    Dim i As Long
    Set cnf = CreateObject("Scripting.FileSystemObject")
    fnsh = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row - 2
    Application.ScreenUpdating = False
    For i = 7 To fnsh
    dir = ActiveWorkbook.Path & "\Draughting Requests\" & Cells(i, 1).Value
    Range("A" & i).Hyperlinks.Delete
    ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & i), Address:=dir
    Next
    Set cnf = Nothing
    Application.ScreenUpdating = True
End Sub
[LEFT][COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR][/LEFT]
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

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