模块中: Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long ThisWorbook中 Private Sub Workbook_Open() Dim hWndForm As Long hWndForm = FindWindow("XLMAIN", Application.Caption) SetWindowText hWndForm, "文件名" End Sub Private Sub Workbook_SheetActivate(ByVal Sh As Object) Dim hWndForm As Long hWndForm = FindWindow("XLMAIN", Application.Caption) SetWindowText hWndForm, "文件名" End Sub |