Share via

Text word count statistics

圣 方 1 Reputation point
2022-09-06T06:40:14.843+00:00

sourece
Option Explicit
Dim myDoc As New Document
Private Sub Command2_Click()
On Error Resume Next
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

question
The above is VB6 code

Excuse me in vs2019 transcoding?

answer

Community Center | Not monitored
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.