?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "調用Word"
ClientHeight = 3015
ClientLeft = 60
ClientTop = 345
ClientWidth = 2805
LinkTopic = "Form1"
ScaleHeight = 3015
ScaleWidth = 2805
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "單詞統計"
Height = 375
Left = 1560
TabIndex = 2
Top = 2520
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "拼寫檢查"
Height = 375
Left = 120
TabIndex = 1
Top = 2520
Width = 1215
End
Begin VB.TextBox Text1
Height = 2295
Left = 120
MultiLine = -1 'True
TabIndex = 0
Text = "Form1.frx":0000
Top = 120
Width = 2535
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Doc As New Document
'拼寫檢查
Private Sub command1_click()
Form1.Caption = "拼寫檢查"
Doc.Range.Text = Text1
'確定范圍
Doc.Application.Visible = True
'將Word變為可見
AppActivate Doc.Application.Caption
'激活Word
Doc.Range.CheckSpelling
'拼寫檢查
Text1 = Doc.Range.Text
Text1 = Left(Text1, Len(Text1) - 1)
'Doc.Application.Visible = False
End Sub
'統計單詞數
Private Sub Command2_Click()
Dim Dlg As Word.Dialog
Doc.Range = Text1.Text
Set Dlg = Doc.Application.Dialogs(wdDialogDocumentStatistics)
Dlg.Execute
'統計單詞和字符
Form1.Caption = "單詞數:" + Str(Dlg.Words) & "詞" & Str(Dlg.Characters) + "字符"
'顯示統計結果
'Doc.Application.Visible = False
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Doc.Application.Visible Then
Doc.Close savechanges:=False
'關閉文件
Else
Doc.Application.Quit savechanges:=False
'關閉Word
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -