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: 4
Default color function causes save dialog?

I found Chris Pearson's CountByColor function which lets me do exactly
what I want to do. I'm using the function in Excel 2000 on Win98SE.
When I call the function on a worksheet, it causes the save dialog to
appear when the workbook closes, even though there is no new data to
save (for example, open and immediately close the workbook). The save
dialog does not appear when the function call is removed from the
worksheet.

I created a module in the workbook and copied the following code to
the module:

Function CountByColor(InRange As Range, WhatColorIndex _
As Integer, Optional OfText As Boolean = False) As Long
'
' This function returns the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng

End Function

It doesn't make sense to me that this function will cause this
problem. Appearantly, a flag is getting set somewhere, but I don't
know what to do to solve the problem so that I can use the code.

TIA for your help,
Michael Purcell

 
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
Save as dialog David T Excel Discussion (Misc queries) 7 September 28th 07 05:12 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
Changing Save As Type in Save as dialog box Phill Excel Programming 2 August 22nd 03 12:38 PM
Save As Dialog Arne[_2_] Excel Programming 0 July 9th 03 09:18 AM
Save As Dialog Bob Phillips[_5_] Excel Programming 0 July 8th 03 11:09 PM


All times are GMT +1. The time now is 02:34 AM.

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

About Us

"It's about Microsoft Excel"