Delete server connections from excel

nikio8

Board Regular
Joined
Oct 20, 2017
Messages
128
Hi all,
recently there seems to be a problem in excel where it constantly crashes.
I am trying to make it as simple as possible with as few features as possible.

The spreadsheet has few "workbook connections" to a local server. When I open data / connections/ they are there, but there does not exit a button to remove them.

Can they be removed? I only need one connection to another excel file, not even sure how this one was created as file is quite simple.

Thanks in advance,
Nick
 

jmacleary

Well-known Member
Joined
Oct 5, 2015
Messages
796
Office Version
2007
Platform
Windows
Hi there. Which version of excel are you using? In excel 2007, when you open the list of connections, the second button down on the right hand side is Remove. If the workbook is protected that would be greyed out.
 
Last edited:

nikio8

Board Regular
Joined
Oct 20, 2017
Messages
128
hi jm
excel 365. i'll have another look, I could not see remove button.
from its conception the file is possibly 10 years old, it could have some quirks.
so far I am thinking to try, rebooting, deleting some .odc?? files from my connection folder. reinstalling office.
creating completely new file and slowly copy paste each sheet.
very rarely is there any advice on how to connect to server directly, possibly this is my chance to practice some more.
but as this is work, I cannot waste too much time
 

jmacleary

Well-known Member
Joined
Oct 5, 2015
Messages
796
Office Version
2007
Platform
Windows
Ah. 365 has some difficulties in this area. On another site I found this code that will remove ALL connections. You could use it to remove them all and then just reinstate the one you need. Alternatively, the code could be modified to skip over the one you want to keep.
Code:
Sub Remove()
Dim connection As WorkbookConnection
Dim query As WorkbookQuery
On Error Resume Next
For Each connection In ThisWorkbook.Connections
    connection.Delete
Next
For Each query In ThisWorkbook.Queries
    query.Delete
Next
End Sub
 

nikio8

Board Regular
Joined
Oct 20, 2017
Messages
128
hi, will try. that is quite disappointing.
But i will make a copy of the file and run it tomorrow.
 

nikio8

Board Regular
Joined
Oct 20, 2017
Messages
128
Found it. I knew it was something simple.
Data, power queries and connections. Then go to connections and delete.
However the file got corrupted and was looking for missing vba dll.
I recreated it. was not too bad, forgot to copy one sheet, but it seems to work ok and file is 20x smaller.
 

jmacleary

Well-known Member
Joined
Oct 5, 2015
Messages
796
Office Version
2007
Platform
Windows
Glad you found the answer, well done! And well done for posting the solution.
 

Forum statistics

Threads
1,082,318
Messages
5,364,528
Members
400,804
Latest member
davileal

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top