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: 64
Default procedure continuously being called

I am using "application.volatile" in a function procedure in order for the
procedure to be called. The function does not refer to a cell value and
therefore won't be called unless .volatile is used.

Basically, what I am trying to do is to set the worksheet background to a
particular .gif file when the workbook is changed to/from "read-only". Since
my workbook uses DDE links, it calculates continuously. Therefore, the
function is called continuously, slows the workbook down and makes the screen
flicker as it continuously sets the background picture.

I have separated this task into the following two functions to try to keep
the function that sets the background (function #2) to only run when the
read-only status (function #1) changes, but it still does it continuously:

#1
Function read_only_status() As Byte

Application.Volatile True
If ActiveWorkbook.ReadOnly = True Then
read_only_status = 1
End If
If ActiveWorkbook.ReadOnly = False Then
read_only_status = 2
End If

End Function

#2
Function set_background(status As Byte)

If status = 1 Then
Worksheets("a.book").SetBackgroundPicture "c:watermark.gif"
End If

If status = 2 Then
Worksheets("a.book").SetBackgroundPicture Delete
End If

End Function

Any suggestions as to how I can get this procedure to NOT run continuously
and still actually work?? Thank you.

 
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
How can Oracle DB Stored procedure be called in MS Excel? Amol Excel Discussion (Misc queries) 1 January 7th 07 10:05 AM
private sub- which procedure called it Sunil Excel Programming 2 September 27th 05 12:52 PM
Opening a UserForm causes a crash in the Exit procedure (Which is never called) Brent McIntyre Excel Programming 0 May 12th 04 12:37 PM
Continuously accessible form SS[_3_] Excel Programming 2 January 15th 04 03:27 PM


All times are GMT +1. The time now is 06:47 PM.

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"