Changing Application Title in VBA during Run Time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I been trying to change the application title during the run time.
I know that Me.Application.Name is read only during run time.

Is there a way to change the application name at run time?
Thanks,
 
Here's some subroutines that I've written that allow me to clear an
application title or to set the application title. The trick is that, unless
you've set a title in the Tools | Startup window, the property doesn't exist
and you must create it.


Private Sub ClearTheApplicationTitleText()
Dim dbs As DAO.Database
Dim strCurrentAppTitle As String, strTry As String
On Error Resume Next
Set dbs = CurrentDb
strCurrentAppTitle = "KenTestDB"
With dbs.Containers!Databases.Documents!MSysDb
strTry = .Properties("AppTitle")
If Err.Number <> 3270 Then
.Properties.Delete "AppTitle"
End If
RefreshTitleBar
End With
dbs.Close
Set dbs = Nothing
End Sub




Private Sub SetTheApplicationTitleText(Optional blnBaseTitleOnly As Boolean
= True)
Dim dbs As DAO.Database
Dim prp As DAO.Property
Dim strTitleAddition As String, strCurrentAppTitle As String, strTry As
String
On Error Resume Next
Set dbs = CurrentDb
strCurrentAppTitle = "KenTestDB"
strTitleAddition = ""
If blnBaseTitleOnly = False Then strTitleAddition = Nz(Me.Text0.Value, "")
With dbs.Containers!Databases.Documents!MSysDb
strTry = .Properties("AppTitle")
If Err.Number = 3270 Then
Set prp = .CreateProperty("AppTitle", dbText, strCurrentAppTitle)
.Properties.Append prp
Set prp = Nothing
End If
.Properties("AppTitle") = strCurrentAppTitle & IIf(Len(strTitleAddition)
0, " < " & strTitleAddition & " >", "")
RefreshTitleBar
End With
dbs.Close
Set dbs = Nothing
End Sub
 
Back
Top