I have an Access database (2003) with a button that opens an excel spreadsheet (also 2003) and dumps data into it. The spreadsheet contains a lot of calculations based on this data. There is also a custom add-in that gets installed when excel is opened. All of this works correctly. The problem is the functions defined in the add-in retain the directory information in the cell value. If I do a find and replace to delete all of these directories, everything works correctly and the functions calculate. Without find and replace, the directory remains and the function returns #VALUE.
In the code that opens excel and installs the add-in, I tried putting a find and replace, but it always returns with something along the lines of, "there is nothing to replace." This is occurring because the spreadsheet isn't loading fast enough for it to update the cells with the formulas. Once the spreadsheet loads, I can then do the find and replace manually.
Does anyone know how to make the worksheet wait until everything loads before executing the find and replace?
I've tried adding a wait using a loop:
Dim clock As Long
clock = 0
Do
clock = clock + 1
Loop Until clock = 7500000
My code for the find and replace is this:
wbk.Sheets("Calculation").Activate
Cells.Replace What:="'C:\Work\AddIns\Tools.xla'!", Replacement _
:="", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
Does anyone know what I can do to make this work correctly?
Thanks.