LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default application.volatile activation

Hi,

I built a macro that reads data from a text file and returns a string value
from it. When the user puts "=MyMacro(xxx)" in a cell, the returned value
will be some string from my text file. When the user ask Excel to
recalculate the workbook (F9 I believe), my macro is not executed. It will
be executed only if I put "Application.Volatile" as the first line of that
macro. I want the user to be able to trigger a recalculation of all the
cells that use my macro.

Small problem: reading from a file takes a long time. With
Application.Volatile in my macro, any change to any cell in my workbook will
trigger the execution of my macro for every cell that uses it. If my macro
in used in 1000 cells, I don't want the user to wait for 1000 file accesses
each time he writes something in a cell.

My solution to that problem is that I put a "Refresh" button in Excel's menu
to refresh the cells that use my macro. So when the user wants to recalculate
the cells using my macro, he must press the "Refresh" button, else it won't
be recalculated, even after a F9. How do I implement this solution using the
Application.Volatile?

My comprehension of Application.Volatile is that it must be put as the first
line of a macro to make it auto-recalculable. If I want my macro to contain
Application.volatile only in certain circumstances, how do I do it?

I tried to put "Application.Volatile = bFlag" in my macro, bFlag being set
to true only when the "Refresh" menu button is pressed. Doesn't work. Even
worse: in some occasions, once I put the Application.Volatile to false, it
won't go back to true...

Help!
Thanks,
-C.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call Application.Volatile(True) NOT WORKING FARAZ QURESHI Excel Discussion (Misc queries) 1 May 8th 08 04:50 AM
Application.Volatile Not Working Timely FARAZ QURESHI Excel Discussion (Misc queries) 2 March 10th 08 09:52 AM
Application.Volatile not working as expected Richards Excel Discussion (Misc queries) 3 February 3rd 05 12:20 AM
Need for Application.Volatile? Paul Lautman Excel Programming 2 August 19th 04 10:43 PM
Application.Volatile messing up other function itchyII Excel Programming 1 April 1st 04 04:31 PM


All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"