- Option Explicit
-
- ResizeWindow "Windows 任务管理器", 300, 300
-
-
-
- Sub ResizeWindow(sWindowName, iWidth, iHeight) '窗体名称、宽度和高度(需要安装 Microsoft Word)
- Dim oWord, oTasks, oTask
- Const wdWindowStateNormal = 0
- Set oWord = CreateObject("Word.Application")
- Set oTasks = oWord.Tasks
-
- If oTasks.Exists(sWindowName) Then
- Set oTask = oTasks(sWindowName)
- With oTask
- If .WindowState <> wdWindowStateNormal Then
- .Activate
- .WindowState = wdWindowStateNormal
- End If
- .Resize iWidth, iHeight
- End With
- End If
-
- oWord.Quit
-
- Set oTask = Nothing
- Set oTasks = Nothing
- Set oWord = Nothing
- End Sub
复制代码
|