Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink in a protected sheet

Status
Not open for further replies.

Azban65

Technical User
Jan 12, 2009
11
FR
Hello,

I try to add an hyperlink in a protected sheet within a macro.
It was working well at the beginning, but for some reason, now I have to unlock the cell to use the hyperlink when I protect the sheet.
But now, when you click anywhere on the sheet the hyperlink is activated....

I tryed to add a button in the box, but because i need to sort the data, it need to be place accurately in the box... And to refer to the path store int he same box...

How can I use the hyperlink (created by macro) in a protected box?

Thanks
Azban

Excel 2002
Current code is

Public Sub selectfiletoattach()
Dim Filter As String
Dim InitialDir As String
Dim DialogTitle As String
Dim OutputStr As String
Dim MyName As String
Dim Mynam2 As String

Filter = "File (*.*)" + Chr$(0) + "*.*" + Chr$(0) + _
"All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
InitialDir = "\\ltrfs010\ltrengrng\Production Engineering\"
DialogTitle = "Select The file to attach"
OutputStr = ShowOpen(Filter, InitialDir, DialogTitle)

securityunprotect

i = Sheets("Team LOG").Range("K15")

Sheets("RFP RFM Register").Range("D" & i).Select
Selection.Locked = False
Selection.FormulaHidden = False
Sheets("RFP RFM Register").Range("D" & i).Hyperlinks.add Anchor:=Selection, Address:= _
OutputStr, TextToDisplay:="Link"
filepath.Caption = OutputStr
Sheets("RFP RFM Register").Range("A4").Select

securityprotect
End Sub
 
I guess that the sheet with hyperlink is protected in the way that selection of locked (or unlocked too) cells is not permitted. In this case whatever cell is clicked, unlocked cell is activated (or just hyperlink).
You can either allow more actions on protected sheets or add a shape with hyperlink.

combo
 
yes, it's exactly what I'm saying.
But at the first time, with the same settings, even in a locked cell the hyperlink was working.
I don't know for which obscure reason but now it's not th ecase anymore.

Is there any easy way to add a shape into a box? because a shape is place by coordonate....
 
No, it's not the same. I'd like to know if the selection of cells is permitted when you apply protection.

The "Locked" cell's setting just tells excel if apply protection for a given cell (with some limitations for the whole worksheet) when the user protects the sheet. It is possible to customise protection when setting the password, esp. the possibility to select cells.
Selection of all cells is permitted by default, but this can be changed. In this case the user can either select unlocked cells only or none.
In the first case when you try to select locked area selection jumps to first unlocked cell, if there is a hyperlink here, it follows it.
In the second case you just follow the hyperlink.

So check if in the code that sets protection you have something like EnableSelection set (and the value set), if no, check the setting from excel menu.






combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top