Works in 2003 but not 2007

M

M.Siler

When I reference the below function in 2003 I get function displayed... now
in 2007 I get

#NAME?

Any idea what I need to change/set in 2007 so it will run this function?

Function formulaText(x As Range)

'returns the text equivalent of formula in upper left cell in range x
'example: =formulatext(a1) returns the formula found in cell a1 of
active worksheet
'example: =formulatext(a1:b5) returns the formula found in cell a1 of
active worksheet
formulaText = x.Cells(1, 1).Formula

End Function

Thanks,
Mark
 
B

Bob Phillips

Mark,

It works fine for me. Are you stored in a standard code module?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
M

M.Siler

does it matter if the file is still saved as XLS? Does it have to be XLSX?
Would there be anything else that would prevent the code from running,
perhaps a security setting that I should check?
 
B

Bob Phillips

No XLS works fine, it just opens in compatibility mode.

As to security, it should prompt as before, but sometimes I have found it
doesn't, and there is a new bar with text and a button allowing you to
enable macros.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
N

Niek Otten

But did you check where the function resides, as Bob suggested? It should be in a Standard module, not a Sheet or Workbook module


--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| does it matter if the file is still saved as XLS? Does it have to be XLSX?
| Would there be anything else that would prevent the code from running,
| perhaps a security setting that I should check?
|
|
| | > Works for me in XL2007 also
| > --
| > Bernard V Liengme
| > www.stfx.ca/people/bliengme
| > remove caps from email
| >
| > | >> Mark,
| >>
| >> It works fine for me. Are you stored in a standard code module?
| >>
| >> --
| >> ---
| >> HTH
| >>
| >> Bob
| >>
| >> (there's no email, no snail mail, but somewhere should be gmail in my
| >> addy)
| >>
| >>
| >>
| >> | >>> When I reference the below function in 2003 I get function displayed...
| >>> now in 2007 I get
| >>>
| >>> #NAME?
| >>>
| >>> Any idea what I need to change/set in 2007 so it will run this function?
| >>>
| >>> Function formulaText(x As Range)
| >>>
| >>> 'returns the text equivalent of formula in upper left cell in range x
| >>> 'example: =formulatext(a1) returns the formula found in cell a1 of
| >>> active worksheet
| >>> 'example: =formulatext(a1:b5) returns the formula found in cell a1 of
| >>> active worksheet
| >>> formulaText = x.Cells(1, 1).Formula
| >>>
| >>> End Function
| >>>
| >>> Thanks,
| >>> Mark
| >>>
| >>
| >>
| >
| >
|
|
 
D

Dana DeLouis

Just guessing of course, but was the program listed in your Personal.xls
workbook?
Depending on what you are doing, you may have to reset your vba Library
reference to point to it.
Otherwise, the function name is something like:
=PERSONAL.XLS!FormulaText()
Again, just throwing out an idea..
 
Top