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

📄 form1.frm

📁 调用word中的语法检查功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Word语法检查"
   ClientHeight    =   1410
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3660
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   1410
   ScaleWidth      =   3660
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      Height          =   300
      Left            =   1545
      TabIndex        =   1
      Text            =   "studeny"
      Top             =   210
      Width           =   1650
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   360
      Left            =   1260
      TabIndex        =   0
      Top             =   795
      Width           =   1080
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "请输入一个单词:"
      Height          =   180
      Left            =   75
      TabIndex        =   2
      Top             =   240
      Width           =   1440
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
    On Error GoTo errHdl
    Dim mWord As Object
    
    Screen.MousePointer = vbHourglass
    Set mWord = CreateObject("Word.Application")
    mWord.Visible = False

    mWord.Documents.Add
    mWord.Selection.Text = Text1.Text
    mWord.ActiveDocument.CheckSpelling
    Text1.Text = mWord.Selection.Text
    mWord.Quit
    Set mWord = Nothing
    Screen.MousePointer = vbDefault
    Exit Sub
errHdl:
    MsgBox "请确信你安装的Word语法检查器(mssp232.dll)", vbCritical, "提示"
    Screen.MousePointer = vbDefault
End Sub

⌨️ 快捷键说明

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