Dave, here is the code I'm using, it may even be some of yours. I can't find
any missing references. Am I missing something?
Sub BreakLinks()
Dim wks As Worksheet
Dim rng As Range
Dim myCell As Range
Dim myStr As String
For Each wks In ActiveWorkbook.Worksheets
Set rng = Nothing
On Error Resume Next
Set rng = wks.UsedRange.Cells.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0
If rng Is Nothing Then
'do nothing--no formulas
Else
For Each myCell In rng.Cells
With myCell
Code fails here ----- myStr = LCase(.Formula)
If InStr(1, myStr, ".xls") > 0 _
And InStr(1, myStr, "!") > 0 _
And InStr(1, myStr, "]") > 0 _
And InStr(1, myStr, "[") > 0 Then
'maybe it's a link
.Value = .Value
End If
End With
Next myCell
End If
Next wks
End Sub
The code fails on the noted line. TIA
Greg
Dave Peterson said:
I'd check for any missing references in the VBE.
With your project selected, click on tools|references
Look for Missing. When you find it, you'll have to decide whether you need that
reference or if you can delete it.
If you need it (or something like it), you may want to consider using late
binding.
Your code can find the current version for each pc and use that.
Tom Ogilvy posted this recently:
Here are some more extensive references on binding:
Use late binding - don't have a reference to excel.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions
http://support.microsoft.com/default.aspx?scid=kb;en-us;245115
INFO: Using Early Binding and Late Binding in Automation
http://support.microsoft.com/default.aspx?scid=kb;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible
GregR wrote:
I use ExcelXP at home and Excel 2000 here at work. I am getting a compile
error on this line at work:
myStr = LCase(.Formula)
This module works at home but not here at work. Why? TIA
Greg