Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Status Bar more complex

I want to be able to control the status bar. Here is an example of what I am
doing as a test.

I Sheet1 if I change to Column "C" Then the status bar changes to:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Column = 3 Then
oldStatusbar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = "I changed this to what I want."
Else
Application.StatusBar = False
End If
End Sub

Now if the Status Bar says "I changed this to what I want." and I hit save
it will go back to "Ready" based on the following code. How would I make the
Status Bar go back to "I changed this to what I want." if that is what was
showing otherwise I would want it to go to "Ready". Note: I also want the
user to be able to see the "Saving ..... .xls " as it happens and then
change back to the "Ready" or "I changed this to what I want." as the case
may be. Here is what I have in the Before_Save

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim sFile
'<Optional - this would be before save code
Cancel = True
Application.EnableEvents = False
If SaveAsUI Then
sFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If sFile < False Then
ThisWorkbook.SaveAs sFile
'<Optional - this would be after save code
End If
Else
ThisWorkbook.Save '******
'<Optional - this would be after save code
Application.StatusBar = False
End If
Application.EnableEvents = True
End Sub

Thank you for your help,

Steven
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Status Bar more complex

Steven,

There are a few things needed he

In the Before_Save you have Application.StatusBar = False in the wrong
place. It should go right before the ... If SaveAsUI Then

You also need a Sub routine that has the same code as the
Worksheet_SelectionChange. I called this Sub ControlStatusBar and put in
Module1.

Then in the Before_Save you need to have .. Call ControlStatusBar .. before
the Application.EnableEvents = True

Also you have to put .. Call ControlStatusBar .. in the Before_Close. You
have to do this to insure that you get the status bar back to its original
setting when you close the file. Otherwise you may end up with "I changed
this to what I want." if you save the file and are in Column C.

Dougla
---------------------------------------------------------------------------------------------
"Steven" wrote:

I want to be able to control the status bar. Here is an example of what I am
doing as a test.

I Sheet1 if I change to Column "C" Then the status bar changes to:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Column = 3 Then
oldStatusbar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = "I changed this to what I want."
Else
Application.StatusBar = False
End If
End Sub

Now if the Status Bar says "I changed this to what I want." and I hit save
it will go back to "Ready" based on the following code. How would I make the
Status Bar go back to "I changed this to what I want." if that is what was
showing otherwise I would want it to go to "Ready". Note: I also want the
user to be able to see the "Saving ..... .xls " as it happens and then
change back to the "Ready" or "I changed this to what I want." as the case
may be. Here is what I have in the Before_Save

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim sFile
'<Optional - this would be before save code
Cancel = True
Application.EnableEvents = False
If SaveAsUI Then
sFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If sFile < False Then
ThisWorkbook.SaveAs sFile
'<Optional - this would be after save code
End If
Else
ThisWorkbook.Save '******
'<Optional - this would be after save code
Application.StatusBar = False
End If
Application.EnableEvents = True
End Sub

Thank you for your help,

Steven

Reply
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
complex color fill conditions- if statements or complex formula? lilly8008 Excel Discussion (Misc queries) 1 December 18th 09 04:57 AM
reuest formula for auto update status & status date PERANISH Excel Worksheet Functions 5 June 2nd 08 04:26 PM
Status Bar Alan Beban[_2_] Excel Programming 1 August 25th 07 04:20 AM
Complex Index Match Help (or at least complex to me) Jennifer Reitman Excel Discussion (Misc queries) 3 August 10th 06 08:51 PM
Need a msg box that displays time status or loading status havocdragon Excel Programming 2 April 2nd 05 05:29 PM


All times are GMT +1. The time now is 06:15 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"