I have an Excel 2007 macro (Visual Basic 6.5) that throws Type Mismatch errors running under Excel 2010. The errors occur with reference to VB functions like Mid()
or Instr()
.
Can anyone tell me the cause of these errors?
If VB.NET is not installed (or not current) on the Excel 2010 system, could this cause the errors?
This macro is used by a number of people on a variety of systems. Previously I have worked around these errors by writing my own functions.
Here is the relevant code, the error occurs in the middle line:
bdash = 0
bdash = InStr(Dfiles(ii, 1), "-")
bperiod = InStr(bdash, Mid(Dfiles(ii, 1), "."))
bname$ = Mid(Dfiles(ii, 1), 1 + bdash, bperiod - 2)
tprefix$ = Mid(TemplateFile$, 1, 12)