Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

ActiveWindow.Caption

Latest post Thu, Jun 24 2010 8:12 PM by Rick Williams. 1 replies.
  • Wed, Jun 23 2010 9:22 AM

    ActiveWindow.Caption

    Is there a way to center the caption on a window?  I've changed it from the file name to an instruction, but it aligns left and I can't seem to find anyway to adjust it.  To be clear, this is the caption on a workbook, not a userform.

     

    Thanks,

     

    Jake

    • Post Points: 21
  • Thu, Jun 24 2010 8:12 PM In reply to

    • Rick Williams
    • Top 25 Contributor
    • Joined on Wed, Jan 9 2008
    • Melbourne, Australia
    • Posts 76
    • Points 1,189

    With my limited knowledge on the subject, I'd say no, but can you try to fudge it by inserting spaces at the start of the caption?  I guess you could look at the window.width to try and estimate how many spaces you'd need...

    I was fiddling and came up with this, YMMV:

    Private Sub Workbook_WindowResize(ByVal Wn As Window)
        Wn.Caption = String(Int(Wn.Width / 6), Chr(32)) & "My Text"    
    End Sub

    Also seems that window captions can't exceed about 200 characters, when it drops an error.

    FWIW, in Excel 2007 the captions (of maximised spreadsheet sub-windows) are centred anyway.. but they move around too when different 'context tabs' appear and disappear...

     

    As an alternative, would a conspicuous floating text box at the top of the visible range be an alternative solution?

     

     

    Rick Idea
    Melbourne, Australia

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright Excel User Group and the relevant contributors, 2010. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.