vbaのアンケート集計について質問です。
vbaのアンケート集計について質問です。 下記のコードが実行できません。なぜでしょうか? Sub アンケート集計() Dim wsh As New IWshRuntimeLibrary.WshShell Dim result As WshExec Dim fileData() As String Dim path As String Dim cmd As String path = ThisWorkbook.path & "\アンケート" cmd = "dir " & path & " /b" Set result = wsh.Exec("%ComSpec% /c " & cmd) Do While result.Status = 0 DoEvents Loop fileData = Split(result.StdOut.ReadAll, vbCrLf) Dim i As Long i = 3 For Each strData In fileData Cells(i, 2).Value = strData If Cells(i, 2).Value <> "" Then Cells(i, 3).Value = "='" & path & "\[" & strData & "]Sheet1'!T5" Cells(i, 4).Value = "='" & path & "\[" & strData & "]Sheet1'!F9" Cells(i, 5).Value = "='" & path & "\[" & strData & "]Sheet1'!D15" Cells(i, 6).Value = "='" & path & "\[" & strData & "]Sheet1'!I15" Cells(i, 7).Value = "='" & path & "\[" & strData & "]Sheet1'!P15" Cells(i, 8).Value = "='" & path & "\[" & strData & "]Sheet1'!U15" Cells(i, 9).Value = "='" & path & "\[" & strData & "]Sheet1'!H12" End If i = i + 1 Next End Sub
Visual Basic・35閲覧・25