Mystery Macros - How do you get rid of them??


Posted by Shane E. on April 23, 2001 11:01 AM

I have some excel spreadsheets that I inherited from someone else. They have multiple worksheets and whenever I open them I always get the prompt box regarding macros. On some of the spreadsheets I can go to Tool, Macros and see the macros listed, but cannot delete them. On others no macros show up in the list. I have the same problem with mystery links. Any suggestions on an easy way to get rid of these things?

Posted by STEVE on April 23, 2001 11:38 AM

Hi shane
The macros are probably there for a reason. You can go to tools/macro/security set the security low and have the measage not pop-up when you open the workbook. If you really want to delete all the macros press ALT+F11 to get the VBA editor and the delete all modules.
steve

Posted by Shane E on April 23, 2001 2:50 PM

Re: Mystery Macros module deletion - Now what about links?


Excellent! That worked great for the macros. Do you have any suggestions for mystery links

Posted by steve on April 23, 2001 8:22 PM

Re: Mystery Macros module deletion - Now what about links?

Yes
The links are probably not a mystery, the links mean that this file is linked to another workbook. What you need to do is find the link and make it so it's not a link any more.
Example:THIS IS AN EXAMPLE OF A LINK
='C:\WINDOWS\Desktop\[MY FILE.xls]PRICE'!E8
what you need to do is make it so its no longer a link.
=E8
or you can copy the cell and paste the value only or just delete it if its not needed.
Here's a hint to help you find the links select
TOOLS/OPTIONS/ and on the view page select formulas. Now you can see all the formulas on the page now look for links and fix them. When finished deselect formulas. You will then want to save and reopen to see if you fixed the links.
Hope this helps
steve



Posted by Dave Hawley on April 23, 2001 11:32 PM

Re: Mystery Macros module deletion - Now what about links?


Hi Shane, here some more info on Phantom links:

1. Go to Insert>Name>Define and make sure you do not have any named ranges refering to an outside Workbook.

2. Go to Edit>Links and try to use the "Change Source" button to refer your link back to the your open workbook. In other words try and change the link so it refers to itself.

3. Open the a new workbook and create a link to it and Save. Now go to Edit>Links and use the "Change Source" to refer the link to the new Workbook. Save again and then delete the link you created.

.....If all the above fail, microsoft have seen this as a problem and have a free download here:

http://support.microsoft.com/support/kb/articles/Q188/4/49.ASP?LN=EN-US&SD=gn&FR=0&qry=delete%20links&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=XLW97

In fact it is a handy add-in to have even if one of the above steps does work.


....and here is a macro I have written that will create a list of ALL external links in Formulas.


Sub ListExternalLinks()

'Written by OzGrid Business Applications
'www.ozgrid.com

'''''''''''''''''''''''''''''''''''''''''''''''''''''
'Creates a Worsheet called "Link List" and lists ALL _
external links in the Workbook.
'''''''''''''''''''''''''''''''''''''''''''''''''''''

Dim sht As Worksheet
Dim LinkCells As Range, Cell As Range
'Add a new sheet to list all external links.
On Error Resume Next
Sheets.Add().Name = "Link List"
Application.DisplayAlerts = False
'If name does NOT = "Link List" then it already exists
If ActiveSheet.Name <> "Link List" Then ActiveSheet.Delete
Application.DisplayAlerts = True
'Clear column A and format as text.
Sheets("Link List").Columns(1).Clear
Sheets("Link List").Columns(1).NumberFormat = "@"
'Loop through each worksheet
For Each sht In ThisWorkbook.Worksheets
'Set "LinkCells" to range that has formulas
Set LinkCells = Nothing
Set LinkCells = sht.Cells.SpecialCells(xlCellTypeFormulas)
If Not LinkCells Is Nothing Then
'Loop through each cell in "LinkCells"
For Each Cell In LinkCells
'See if if an external link or not.
If Cell.Formula Like "[*" Then
'It is, so copy the formula to column A of "Link List"
Sheets("Link List").Cells _
(65536, 1).End(xlUp).Offset(1, 0) = Cell.Formula
End If
Next Cell
End If 'Not LinkCells Is Nothing
Next sht
End Sub

Dave

OzGrid Business Applications