⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "利用word统计字数和检查拼写检查"
   ClientHeight    =   4050
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6300
   LinkTopic       =   "Form1"
   ScaleHeight     =   4050
   ScaleWidth      =   6300
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command2 
      Caption         =   "统计字数"
      Height          =   645
      Left            =   4575
      TabIndex        =   2
      Top             =   3000
      Width           =   1515
   End
   Begin VB.TextBox Text1 
      Height          =   3645
      Left            =   240
      MultiLine       =   -1  'True
      TabIndex        =   1
      Text            =   "Form1.frx":0000
      Top             =   270
      Width           =   4155
   End
   Begin VB.CommandButton Command1 
      Caption         =   "拼写检查"
      Height          =   645
      Left            =   4560
      TabIndex        =   0
      Top             =   2280
      Width           =   1515
   End
   Begin VB.Label Label2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   4650
      TabIndex        =   4
      Top             =   1320
      Width           =   1395
   End
   Begin VB.Label Label1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   4650
      TabIndex        =   3
      Top             =   360
      Width           =   1395
   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 myDoc As New Document
Private Sub Command1_Click()
  myDoc.Range.Text = Text1
  myDoc.Application.Visible = True
  AppActivate myDoc.Application.Caption
  myDoc.Range.CheckSpelling
  Text1 = myDoc.Range.Text
  Text1 = Left(Text1, Len(Text1) - 1)
  AppActivate Caption
End Sub

Private Sub Command2_Click()
  Dim wordDlg As Word.Dialog
  myDoc.Range = Text1.Text
  Set wordDlg = myDoc.Application.Dialogs(wdDialogDocumentStatistics)
  wordDlg.Execute
  Label1.Caption = "单词数:" & Str(wordDlg.Words) & "词"
  Label2.Caption = "字符数:" & Str(wordDlg.Characters) & "字符"
End Sub

Private Sub Form_Unload(Cancel As Integer)
  If myDoc.Application.Visible Then
  myDoc.Close savechanges:=False
  Else
  myDoc.Application.Quit savechanges:=False
  End If
End Sub

'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -