View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_4_] Harald Staff[_4_] is offline
external usenet poster
 
Posts: 70
Default File Location code

Hi Rohit

Excel 97 is older than Excel 2000, which is older than Excel XP. Things (here StrReverse)
are invented and added to each new version. Great thing is that nothing is removed. For
cross-version development you /must/ use the oldest version to develop on, or you're
working blindfolded and will be rewarded by error messages like this.

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"Rohit Thomas" wrote in message
...
Hello All,

I'm using the following modified code that was posted
by "Dan E." several weeks ago to write the path of a file
out to a cell. Below is the code:

FileName = Application.GetOpenFilename("Text Files _
(*.txt), *.txt")
CellLocation = Len(FileName) + 1 - InStr(1, StrReverse _
(FileName), "\")
FilePath = Mid(FileName, 1, CellLocation)
Range("G46").Value = FilePath

When I run this code using Excel 97, it gives me the
following error: Sub or Funtion not defined for
"StrReverse". Works fine on Excel 2K, what am I missing?

Thanks in advance,
Rohit