PDA

View Full Version : Max characters allowed on status bar?



mcomp72
10-01-2018, 12:05 AM
I have a workbook where I constantly display some information on the status bar, so the user can see it no matter what sheet they are currently looking at. Since I updated my Office 365 to the most current version the other day, I notice that the last two characters on my message on the status bar do not appear, but instead a '...' appears, as if to indicate my message is too long. Is there a maximum number of characters allowed to be displayed on the status bar now? If so, can it be changed via VBA code? I would really like the entire message to be displayed. There is still plenty of room on the status bar, so it seems silly that all of the characters would not be visible.

macropod
10-01-2018, 12:58 AM
Cross-posted at: https://www.mrexcel.com/forum/excel-questions/1072272-max-characters-allowed-statur-bar.html
Please read VBA Express' policy on Cross-Posting in item 3 of the rules: http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3

mcomp72
10-01-2018, 09:22 AM
Sorry, I did not realize it was against the rules to post the same question to a different forum, since I did not receive an answer to my post on the other forum. If I ever find myself needing to do it again, I will be sure to include a link to the first posting inside my question.

I just asked the following question over at Mr. Excel, but if you do not have an account over there, I would like to ask if you could please respond to the following: have you ever experienced this issue before, and if so, what Excel are you using (2010, 2013, 2016, Windows, Mac, etc), and are you using the most up-to-date version of it? I am trying to pinpoint where this issue happens. Before I downloaded the most current updates to Office 365, I don't remember ever noticing it.

Paul_Hossler
10-01-2018, 10:55 AM
Sorry, I did not realize it was against the rules to post the same question to a different forum, since I did not receive an answer to my post on the other forum. If I ever find myself needing to do it again, I will be sure to include a link to the first posting inside my question.


Not against the rules, but we just like to know so that if you get an answer, we don't waste time unnecessarily



The FAQ is in my sig

http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3


ExcelGuru has a very nice explanation of the issue (also a link in our FAQ)

https://www.excelguru.ca/content.php?184

mcomp72
10-05-2018, 03:19 PM
I did not receive a reply to my post here, so I just posted about this issue on another forum. Link to that post can be found here:
https://stackoverflow.com/questions/52673897/excel-2016-vba-status-bar-not-showing-complete-message

Paul_Hossler
10-05-2018, 05:56 PM
An option might be to scroll the text


https://www.mrexcel.com/forum/excel-questions/63392-text-scroll-status-bar-how.html



Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)

Public Sub StatusbarAnimate()

Dim sText As String
Dim iLength As Integer
Dim bForwards As Boolean


sText = "Hello"
iLength = Len(sText) + 1
bForwards = True
rep = 0

Do
DoEvents
rep = rep + 1
If bForwards Then
sText = " " & sText
Else
sText = Right(sText, Len(sText) - 1)
End If

If Len(sText) > 30 Then
bForwards = False
End If

If Len(sText) < iLength Then
bForwards = True
End If
Sleep 150
Application.StatusBar = sText
If rep > 50 Then GoTo break
Loop
break:
Application.StatusBar = ""


sText = "Hello again"
iLength = Len(sText) + 1
bForwards = True
rep = 0

Do
DoEvents
rep = rep + 1
If bForwards Then
sText = " " & sText
Else
sText = Right(sText, Len(sText) - 1)
End If

If Len(sText) > 30 Then
bForwards = False
End If

If Len(sText) < iLength Then
bForwards = True
End If
Sleep 150
Application.StatusBar = sText
If rep > 50 Then GoTo break1

Loop
break1:
Application.StatusBar = ""
End Sub

mcomp72
10-05-2018, 06:40 PM
Thanks for that, Paul. Interesting. I will take a look more closely at that idea.

In the meantime, would you mind downloading my test file? I would love to hear if you report the same behavior that I mentioned in my post over at Stack Overflow. Also, would love to know what version of Excel you have. I'm trying to understand why this is happening, but have had no luck in figuring it out so far.

My Stack Overflow message is here:
https://stackoverflow.com/questions/52673897/excel-2016-vba-status-bar-not-showing-complete-message

My test file can be found here:
https://www.dropbox.com/s/if8693weievd7vw/Test-StatusBarMessage.xlsm?dl=0


(https://www.dropbox.com/s/if8693weievd7vw/Test-StatusBarMessage.xlsm?dl=0)

mcomp72
10-05-2018, 08:03 PM
In case you are not wanting to download my file, here is the code that is in my file.

In Sheet1 Module:


Private Sub Worksheet_Change(ByVal Target As Range)

Application.StatusBar = MessageToDisplay

End Sub


In ThisWorkbook Module:


Private Sub Workbook_Open()

Application.StatusBar = MessageToDisplay

End Sub


In Module1 Module:


Function MessageToDisplay() As String

Dim ValueCellA1 As String

ValueCellA1 = ThisWorkbook.Sheets("Sheet1").Range("A1").Value

MessageToDisplay = "This is a test to see how long of a message can be displayed on the status bar. I have noticed in Excel 2016 (most current version) that there seems to be a limit. The value of Cell A1 is: " & ValueCellA1

End Function

Paul_Hossler
10-06-2018, 06:19 AM
I did test little differently also using 360

This is at full screen I don't know what would happen if the window were half screen

Max length is 256 characters, BUT if it's too long to display the status bar goes blank

I did 256 dots and 256 M's. The Dots fit, the Ms did not




Option Explicit


'Api declaration for suspending operation for a specified time
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub MakeLonger()
Dim i As Long

Application.StatusBar = "M"
On Error GoTo Oops
For i = 2 To 500
Application.StatusBar = Application.StatusBar & "M"
DoEvents
Sleep 100
Next i

Exit Sub
Oops:
MsgBox i

End Sub





22988

22989