Application.MemoryUsed in XL2007

G

George Nicholson

Has anyone seen this (Application.MemoryUsed) work or fail to work in 2007?

This morning a coworker fired up an Excel app on their spanking new PC
running Office 2007. An Error (Type mismatch?) was raised when the code
hit: Application.MemoryUsed.

The app runs fine on various machines using Excel 2003. I don't have 2007
installed on any of my machines yet, so I was limited to doing a quick fix
on the offending machine. Typing "? Application.MemoryUsed" in the
Immediate window generated an error as well (sorry, not sure what it was..).
A MSKB search returned nada. Therefore, assuming that either the object
model or functionality had changed, I simply commented out the offending
line, since it was only an informational output to the status bar. This got
my user back up & running, so the crisis was averted.

However, I would like to be able to restore the status bar message that
includes Application.MemoryUsed. Any thoughts on the subject would be
welcome.

Is this a change, a bug, or an indication I'm going nuts? (pick no more than
one)
 
N

Niek Otten

Hi George,

See

http://msdn2.microsoft.com/en-us/library/bb149139.aspx

MemoryUsed no longer seems to be a property of the Application object. Note that in Excel2007 the equivalent was removed from the
INFO worksheet function as well.
Sorry I don't know of any new facility replacing this one.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| Has anyone seen this (Application.MemoryUsed) work or fail to work in 2007?
|
| This morning a coworker fired up an Excel app on their spanking new PC
| running Office 2007. An Error (Type mismatch?) was raised when the code
| hit: Application.MemoryUsed.
|
| The app runs fine on various machines using Excel 2003. I don't have 2007
| installed on any of my machines yet, so I was limited to doing a quick fix
| on the offending machine. Typing "? Application.MemoryUsed" in the
| Immediate window generated an error as well (sorry, not sure what it was..).
| A MSKB search returned nada. Therefore, assuming that either the object
| model or functionality had changed, I simply commented out the offending
| line, since it was only an informational output to the status bar. This got
| my user back up & running, so the crisis was averted.
|
| However, I would like to be able to restore the status bar message that
| includes Application.MemoryUsed. Any thoughts on the subject would be
| welcome.
|
| Is this a change, a bug, or an indication I'm going nuts? (pick no more than
| one)
|
|
 
G

George Nicholson

Thanks Niek,

I came across ...

http://msdn2.microsoft.com/en-us/library/bb242662.aspx
Object Model Changes Since Microsoft Office XP (2002)
from Excel 2007 Developer Reference

....and it lists Application.MemoryUsed as "Hidden", so I assume that's some
sort of euphemism for "unavailable"/"gone"/"legacy code that uses this will
break bwah-hah-hah".

Office 2007 Help still contains an entry for MemoryUsed, but you have to
read the entry carefully before you realize that the "Applies To" list no
longer includes Application and is now confined to just the PivotCache
object. Confusing things a bit more is the fact that the code example with
that Help entry uses Application.MemoryUsed!

Oh, well...
 
H

Harlan Grove

Has anyone seen this (Application.MemoryUsed) work or fail to work in 2007?

This morning a coworker fired up an Excel app on their spanking new PC
running Office 2007. An Error (Type mismatch?) was raised when the code
hit: Application.MemoryUsed.

The app runs fine on various machines using Excel 2003. I don't have 2007
installed on any of my machines yet, so I was limited to doing a quick fix
on the offending machine. Typing "? Application.MemoryUsed" in the
Immediate window generated an error as well (sorry, not sure what it was..).
A MSKB search returned nada. Therefore, assuming that either the object
model or functionality had changed, I simply commented out the offending
line, since it was only an informational output to the status bar. This got
my user back up & running, so the crisis was averted.

However, I would like to be able to restore the status bar message that
includes Application.MemoryUsed. Any thoughts on the subject would be
welcome.

Is this a change, a bug, or an indication I'm going nuts? (pick no more than
one)
 
H

Harlan Grove

George Nicholson said:
This morning a coworker fired up an Excel app on their spanking
new PC running Office 2007. An Error (Type mismatch?) was raised
when the code hit: Application.MemoryUsed. ....
on the offending machine. Typing "? Application.MemoryUsed" in the
Immediate window generated an error as well (sorry, not sure what
it was..).
....

Shame you didn't catch the error message. If the error is type
mismatch, is it possible this spreadsheet/macro is using more than 2GB
RAM? In Excel 2003 and prior, the Memory* properties are all type
Long, which means they have an upper limit of 2,147,483,647. If this
user's copy were using more RAM, who knows what this property would
do?

Maybe it's time for you to use use Windows API calls to get memory use
info from the OS.
 
Top