📄 form1.frm
字号:
Strikethrough = 0 'False
EndProperty
Height = 2055
Left = 720
TabIndex = 8
Top = 960
Width = 2895
Begin VB.ListBox List1
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 630
ItemData = "Form1.frx":0004
Left = 1320
List = "Form1.frx":0006
TabIndex = 12
Top = 960
Width = 1335
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 9
Top = 360
Width = 1335
End
Begin VB.Label Label3
Caption = "段落格式:"
Height = 255
Left = 120
TabIndex = 11
Top = 1080
Width = 1095
End
Begin VB.Label Label2
Caption = "段落数量:"
Height = 375
Left = 120
TabIndex = 10
Top = 360
Width = 1095
End
End
Begin VB.CommandButton Command3
Caption = "结束"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6240
TabIndex = 7
Top = 6720
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "关闭"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3720
TabIndex = 6
Top = 6720
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "打开"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 5
Top = 6720
Width = 975
End
Begin VB.TextBox Text11
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2655
Left = 7800
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 4
Top = 2760
Width = 3495
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 8640
TabIndex = 2
Top = 1200
Width = 2655
End
Begin VB.Label Label12
Caption = "WORD文档的内容:"
Height = 255
Left = 7800
TabIndex = 3
Top = 2160
Width = 1695
End
Begin VB.Label Label4
Caption = "标题:"
Height = 255
Left = 7920
TabIndex = 1
Top = 1200
Width = 855
End
Begin VB.Label Label1
Caption = "word"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4800
TabIndex = 0
Top = 480
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fire As Word.Application
Private Sub Command1_Click()
Dim myrange As Range
Dim mrange As Range
Dim nrange As Range
Set fire = CreateObject("word.application") '定义一个Word的application的类型
fire.Visible = False
fire.Documents.Open ("C:\WINDOWS\Desktop\01级计算机科学与技术专业.doc") '打开word文档
Text1.Text = ActiveDocument.Paragraphs.Count '读取段落数量
If ActiveDocument.Paragraphs(2).Alignment = wdAlignParagraphCenter Then '读取段落格式
List1.AddItem "居中"
End If
If ActiveDocument.Paragraphs(2).Alignment = wdAlignParagraphJustify Then
List1.AddItem "两端对齐"
End If
If ActiveDocument.Paragraphs(2).Alignment = wdAlignParagraphLeft Then
List1.AddItem "左对齐"
End If
If ActiveDocument.Paragraphs(2).Alignment = wdAlignParagraphRight Then
List1.AddItem "右对齐"
End If
If ActiveDocument.Tables.Count = 0 Then '读取表格的列数、行数和单元格的内容
Text8.Text = "无"
Text9.Text = "无"
Text10.Text = "无"
Else
Text8.Text = ActiveDocument.Tables(1).Columns.Count
Text9.Text = ActiveDocument.Tables(1).Rows.Count
Text10.Text = ActiveDocument.Tables(1).Cell(3, 3).Range.Text
End If
Set myrange = ActiveDocument.Range(Start:=13, End:=20) '读取选定范围内的字符
Text5.Text = myrange.Text
If myrange.Words(1).Bold = True Then '读取字体的格式
List2.AddItem "粗体"
End If
If myrange.Words(1).Italic = True Then
List2.AddItem "斜体"
End If
If myrange.Words(1).Bold = True Then
List2.AddItem "下划线"
End If
List2.AddItem myrange.Words(1).Font.Name
List2.AddItem myrange.Words(1).Font.Size
Set mrange = ActiveDocument.Range(Start:=0, End:=2500) '读取一定范围内的内容
Text11.Text = mrange.Text
Set nrange = ActiveDocument.Range(Start:=0, End:=14) '读取文档的标题
Text3.Text = nrange.Text
If ActiveDocument.Shapes.Count = 0 Then '读取链接或嵌入的对象的格式及类型
Text6.Text = "无"
Text7.Text = "无"
Else
Text7.Text = ActiveDocument.Shapes(1).OLEFormat.ClassType
Text6.Text = ActiveDocument.Shapes(1).LinkFormat.Type
End If
fire.ActiveDocument.Close '关闭当前的文档
fire.Quit '关闭文档
End Sub
Private Sub Command2_Click()
fire.Quit '关闭文档
End Sub
Private Sub Command3_Click()
End '退出
End Sub
Private Sub Form_Load()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -