📄 frwword.frm
字号:
VERSION 5.00
Begin VB.Form frmWrite
Caption = "Automated Word Example"
ClientHeight = 2295
ClientLeft = 60
ClientTop = 345
ClientWidth = 4245
LinkTopic = "Form1"
ScaleHeight = 2295
ScaleWidth = 4245
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txtInput
Height = 1335
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 120
Width = 3855
End
Begin VB.CommandButton cmdWrite
Caption = "Write"
Height = 495
Left = 1440
TabIndex = 0
Top = 1680
Width = 1215
End
End
Attribute VB_Name = "frmWrite"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 17.2
' Demonstrating automation using Word
Option Explicit
Dim mWord As Word.Application
Private Sub Form_Initialize()
Set mWord = New Word.Application
End Sub
Private Sub cmdWrite_Click()
cmdWrite.Enabled = False
Call mWord.Documents.Add
mWord.Selection.Shading.Texture = wdTexture22Pt5Percent
mWord.Selection.Font.Size = 30
Call mWord.Selection.TypeText(txtInput.Text)
Call mWord.Documents(1).SaveAs("d:\word.doc")
Call mWord.Quit
End Sub
Private Sub Class_Terminate()
Set mWord = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -