Home > Software engineering >  [for] use excel statistical word do questionnaire
[for] use excel statistical word do questionnaire

Time:09-20

Want to use the word write a questionnaire survey, option with radio buttons and check boxes, and then use excel by statistical situation, the choice of the options

Found a vba program on the Internet, but this procedure for the option button and check box is an old form of the word, not statistical ActiveX control radio buttons and check boxes, also can't statistics new check box controls,

Can excuse me through some changes, can let the statistical ActiveX control radio buttons and check boxes or new check box controls, thank you!

Procedure is as follows:

 Private Sub CommandButton1_Click () 
Dim myDialog As FileDialog myItem As the Variant, myDoc As Document
Dim myField As FormField, I As Byte, r As Integer
Dim AppExcel As Object, st As Single
On the Error Resume Next
The Set myDialog=Application. FileDialog (msoFileDialogFilePicker)
With myDialog
. The Title="please select handles documents"
. The Filters. The Clear
. Filters. Add all the WORD "file", "*. Docx," 1
. AllowMultiSelect=True
If the Show & lt;> 1 Then the Exit Sub
End With
St=Timer
The Set AppExcel=GetObject (, "Excel. Application")
AppExcel. Application. ScreenUpdating=False
With AppExcel. ActiveWorkbook. ActiveSheet
R=. UsedRange. Row +. UsedRange. Rows. The Count - 1
For Each myItem In myDialog. SelectedItems
The Set myDoc=Documents. The Open (Filename:=myItem, Visible:=False)
For Each myField In myDoc. FormFields
I=I + 1
Rows (r + 1). Cells (I). The Value=https://bbs.csdn.net/topics/myField.Result
Next
I=0
R=r + 1
MyDoc. Close False
Next
End With
AppExcel. Application. ScreenUpdating=True
The Set AppExcel=Nothing
MsgBox "Word data extraction to complete! Available: "& amp; Format (Timer - st, 0) & amp; "Second,"
End Sub

CodePudding user response:

If is the online survey, don't have to work Word preparation, directly make a B/S structure of east east, through a web survey is easy,
  •  Tags:  
  • VBA
  • Related