Forum Discussion
How to stop users adding links to other workbooks
Hi,
We use Excel for preparing budget files. These files then get collated in MS Power BI for group wide analysis.
One issue we have is that users can sometimes paste links from spreadsheets on their desktops into the budget files. This naturally causes problems when other users open them.
Is there any way to prevent external links from being inserted? I've searched in Data Validation and Protect Sheet but haven't found anything suitable.
12 Replies
- NikolinoDEGold Contributor
Got another way to stop hyperlinks, found on the internet.
Break all external links with VBA code
If you want to break all of the external links, both the ok and error links, the following VBA code can help you to break them all.
1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
Sub BreakLinks() 'Updateby20140318 Dim wb As Workbook Set wb = Application.ActiveWorkbook If Not IsEmpty(wb.LinkSources(xlExcelLinks)) Then For Each link In wb.LinkSources(xlExcelLinks) wb.BreakLink link, xlLinkTypeExcelLinks Next link End If End Sub
Then press F5 key to run the code, and all of the external links in the whole workbook have been broken.
Hope I was able to help you with this info.
Nikolino
I know I don't know anything (Socrates)
- mamo72Copper ContributorI've run into same issue.
The problem is not breaking external links. I just wanna prevent my users from using external links.
Users from overseas use Excel budget files (stored in sharepoint) for providing the headoffice with budget monthly figures. I consolidate data coming from these excel files with PowerQuery (Excel or PowerBI).
I just wanna prevent users from using external links to other excel files stored in their pc. I want them to have to type figures. When I receive those files they already contain many "#REF!", so breaking links doesn't help ( they should break external links before sharing the files , but they forget to do that).
When users enter figures by using external links to their excel files I receive many "#REF!" cell which generate an error when I import this files with PowerQuery in another consolidation file or in PowerBI.
How to prevent them from using external links ?- NikolinoDEGold Contributor
Block or unblock external content in Office documents
To help protect your security and privacy, Microsoft Office is configured by default to block external content—such as images, linked media, hyperlinks, and data connections—in workbooks and presentations. Blocking external content helps to prevent Web beacons and other intrusive methods that hackers use to invade your privacy and lure you into running malicious code without your knowledge or consent.
Thank you for your understanding and patience
Nikolino
I know I don't know anything (Socrates)
- Rich_HayesCopper Contributor
I am having this same issue. We use a standard template that users download and complete. The file has embedded logic, data validations and defined pivots. Many users are are saving / copying the data into the template that results in data corruptions, link issues and content enablement warning. The handling of the file seems to pickup every storage location along the way. This is degrading the effectiveness of this tool.
This issue is not Hyper Links but the embedded references to name ranges that get corrupted.
How can this be prevented?
- NikolinoDEGold ContributorStop Automatic Hyperlinks in Excel
How to stop automatic hyperlinks in Excel?
To turn the hyperlink option off in Excel
On the Tools menu, choose AutoCorrect Options
Select the AutoFormat as you type tab
Remove the check mark from Internet and network paths with hyperlinks
Click OK
Remove a Hyperlink Manually
If you want to leave the hyperlink feature on, you can undo the hyperlink immediately after it's created.
To manually remove the hyperlink:
Type the email address and press Enter
Immediately, press Ctrl+Z.
This is a shortcut for Undo, and will convert the hyperlink back to text.
Remove Selected Hyperlinks Programmatically
To change a group of cells that contain hyperlinks, you can use the following code. It deletes all the hyperlinks in the selected cells.
Sub delHyperlinks()
Dim myCell As Range
For Each myCell In Selection
myCell.Hyperlinks.Delete
Next myCell
End Sub
I would be happy to find out if I could help.
Nikolino
I know I don't know anything (Socrates)- alanmccarthyCopper Contributor
NikolinoDE , the issue isn't hyperlinks as such, its cells pointing at external workbooks. So cells with values like the below
='[Desktop Budget File]Project Budget'!$I$23
or
=C://users/userA/desktop/'[Desktop Budget File]Project Budget'!$I$23
- NikolinoDEGold Contributorim not sure but if you make a modul,
insert this code.
Option Explicit
Sub DeleteHyperlinks()
Worksheets("Text").Hyperlinks.Delete
End Sub
Please see this link too, maybe helps:
https://support.microsoft.com/en-gb/office/break-a-link-to-an-external-reference-in-excel-f1ca8b08-4f24-4af6-92e5-f4fdb1442748?ui=en-us&rs=en-gb&ad=gb