VB works as module in worksheet but not in personal.xls
Posted on 2008-06-10
I have pieced together this module from code I found here and around. It is simple, it walks through each worksheet in an excel project and removes all hyperlinks and images. However when I went to create an add in with a toolbar so I could share it, the code no longer works as it did before. It only removes hyperlinks from the current sheet and it removes no images that I am aware of.
Dim mysheet As Worksheet
Dim shp As Shape
Set mysheet = ActiveSheet
'Step through each sheet in the workbook
For Each mysheet In ThisWorkbook.Sheets
'Step through and delete each shape in the current sheet
For Each shp In mysheet.Shapes
'Remove all hyperlinks from the active sheet.
Set mysheet = Nothing
Set shp = Nothing
Any help would be appreciated! I am sure it has something to do with Thisworkbook.sheets pointing to the personal.xls file rather than the spreadheet in question.