Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.
Sub LoadFile2()
Const ForReading As Integer = 1
Dim varFileName, avarData, varData
Dim lngRow As Long, lngColumnCount As Long, lngIndex As Long, lngRecCount As Long
Dim x As Long, y As Long
Dim fso As Object, tsrStream1 As Object
Dim shtNew As Worksheet
Set shtNew = ActiveWorkbook.Sheets.Add
varFileName = Application.GetOpenFilename("CSV Files (*.csv), *.csv", , "Select source file")
If TypeName(varFileName) = "Boolean" Then Exit Sub
Set fso = CreateObject("Scripting.FileSystemObject")
lngRow = 1
Set tsrStream1 = fso.OpenTextFile(varFileName, ForReading, False)
avarData = Split(tsrStream1.ReadAll, vbCrLf)
tsrStream1.Close
Application.ScreenUpdating = False
For lngIndex = LBound(avarData) To UBound(avarData)
If Len(avarData(lngIndex)) > 0 Then
varData = GetRowData(CStr(avarData(lngIndex)))
lngRecCount = UBound(varData, 1)
lngColumnCount = UBound(varData, 2)
shtNew.Cells(lngRow, "A").Resize(lngRecCount, lngColumnCount).Value = varData
lngRow = lngRow + lngRecCount
End If
Next lngIndex
Application.ScreenUpdating = True
End Sub
Function GetRowData(strIn As String) As Variant
Dim varData, varRecs
Dim avarOutput()
Dim lngRecCount As Long
Dim x As Long, y As Long
varData = Split(strIn, ",")
' get rec count from second field
varRecs = Split(varData(1), ";")
lngRecCount = 0
For x = LBound(varRecs) To UBound(varRecs)
If Len(varRecs(x)) > 0 Then lngRecCount = lngRecCount + 1
Next x
If lngRecCount = 0 Then lngRecCount = 1
ReDim avarOutput(1 To lngRecCount, 1 To UBound(varData) + 1)
' now iterate the row data
For x = LBound(varData) To UBound(varData)
If InStr(varData(x), ";") > 0 Then
varRecs = Split(varData(x), ";")
For y = 1 To lngRecCount
avarOutput(y, x + 1) = varRecs(y - 1)
Next y
Else
For y = 1 To lngRecCount
avarOutput(y, x + 1) = varData(x)
Next y
End If
Next x
GetRowData = avarOutput
End Function
Function GetRowData(strIn As String) As Variant
Dim varData, varRecs
Dim avarOutput()
Dim lngRecCount As Long
Dim x As Long, y As Long
varData = Split(strIn, "}")
' get rec count from second field
varRecs = Split(varData(1), ";")
lngRecCount = 0
For x = LBound(varRecs) To UBound(varRecs)
If Len(varRecs(x)) > 0 Then lngRecCount = lngRecCount + 1
Next x
If lngRecCount = 0 Then lngRecCount = 1
ReDim avarOutput(1 To lngRecCount, 1 To UBound(varData) + 1)
' now iterate the row data
For x = LBound(varData) To UBound(varData)
If InStr(varData(x), ";") > 0 Then
varRecs = Split(varData(x), ";")
If lngRecCount > UBound(varRecs) + 1 Then lngRecCount = UBound(varRecs) + 1
For y = 1 To lngRecCount
avarOutput(y, x + 1) = varRecs(y - 1)
Next y
Else
For y = 1 To lngRecCount
avarOutput(y, x + 1) = varData(x)
Next y
End If
Next x
GetRowData = avarOutput
End Function
In Excel, and in the File Open dialogue box select Text as the file type, find the file and then yYou need to use different text file import settings. Choose the 'delimited' option, press 'Next' and select 'commas' and 'semi-colon' as the delimiters, press OK. That will separate the data into sensible columns - see attached file.
Patrick
Test-csv-01.xls