Forum Discussion

vtcs2424's avatar
vtcs2424
Copper Contributor
Dec 07, 2024

Saving... / Saved text in title bar

How to retrieve value from title bar if it has saving... Or saved using VBA in excel.

 

I think that it is used to show if file is synced to SharePoint online or not....

 

PLEASE REMOVE THIS IMAGE IT IS DUPLICATE

 

3 Replies

  • vtcs2424's avatar
    vtcs2424
    Copper Contributor

    Actually once it is been saved / synced in SharePoint online, I need to close the workbook? So isn't there direct reference if it has been synced or not? As relying on caption may close the file unintentionally.

     

    Currently once I do .save and then do .close it has popup of perofrming cleanup. And if I do .save and then manually close I see that it only closes the file if text is saved

     

     

     

    Is it good approach to rely on caption text?

  • Referring this:

     

    1. Access the Title Bar Text:
      • You can use the Application.Caption property to get the text from the title bar.
    2. Check for Specific Text:
      • Use VBA to check if the title bar contains "Saving..." or "Saved".

    Here's a sample VBA code to achieve this:

    Sub CheckTitleBarStatus()
        Dim titleBarText As String
        titleBarText = Application.Caption
        
        If InStr(titleBarText, "Saving...") > 0 Then
            MsgBox "The file is currently saving."
        ElseIf InStr(titleBarText, "Saved") > 0 Then
            MsgBox "The file is saved and synced."
        Else
            MsgBox "The file is not in a saving state."
        End If
    End Sub

    Steps to Implement the Code:

    1. Press Alt + F11 to open the VBA editor.
    2. Insert a new module by clicking Insert > Module.
    3. Copy and paste the above code into the module.
    4. Run the CheckTitleBarStatus macro to check the title bar status.
    • vtcs2424's avatar
      vtcs2424
      Copper Contributor

      Also, application.caption not showing saving... Or saved text, it only shows file name and excel

Resources