Exporting results to excel not working

All about the Software WUFI Plus
Post Reply
WufiApprentice
WUFI User
WUFI User
Posts: 3
Joined: Tue Feb 20, 2024 3:29 am -1100

Exporting results to excel not working

Post by WufiApprentice »

Hello,

I am having problems trying to export simulation results to excel. I have followed the WUFI Plus manual and everything has worked well, except exporting. I have selected CO2, RH and T for excel export, but when I press the "Excel export" button nothing happens. Do you have any ideas what might be the issue?

Version is a Student License, WUFI Plus V.3.5.0.1,
srinivass
WUFI User
WUFI User
Posts: 7
Joined: Tue Aug 02, 2022 11:37 pm -1100

Re: Exporting results to excel not working

Post by srinivass »

Hi there,

I was told that due to issues with Excel export, that feature has been disabled in WUFI 3.5.0.1. The Export to file exports it as .txt file.

Hope this helps.
Shanti
WufiApprentice
WUFI User
WUFI User
Posts: 3
Joined: Tue Feb 20, 2024 3:29 am -1100

Re: Exporting results to excel not working

Post by WufiApprentice »

If anyone runs into this problem in the future, there is a file in (...\WUFI Plus\WUFI\Tools) called "Load WUFIplus Result Textfiles" which can convert exported text file results to excel. The file contains a button, however when running this I kept running into error "Subscript out of range". Finally I have found there is a wrong number in the macro and two misspellings. To fix this, right click the button and click "Assign macro" and then click "Edit". Replace the code with this slightly adjusted code:


Sub WUFITextdatei()
'
' WUFITextdatei Makro
'

Dim datei1$
Dim temp As String
Dim var As Integer
Dim counter As Integer

Dim strCountColumn As String
Dim strCountColumn_ As String
Dim intCountColumn As Integer
Dim intCountheader As Integer
Dim intCountRows As Integer

Dim wb As Workbook

Dim FInfo()
Dim ColumnNames()

Application.ScreenUpdating = False
datei1 = Application.GetOpenFilename("txt-Datei (*.txt),*.txt")
If CStr(datei1) = CStr(False) Then
MsgBox "Please select a WUFI Plus Report-Textfile", 48, "No File selected"
Exit Sub
End If

Open datei1 For Input As #1

Do While counter < 4
Line Input #1, temp
counter = counter + 1
Loop

Line Input #1, temp

strCountColumn = temp
strCountColumn_ = Mid(strCountColumn, 18)
strCountColumn = Left(strCountColumn_, 1)
intCountColumn = Val(strCountColumn_)

counter = 0
ReDim ColumnNames(intCountColumn - 1)

Do While counter < intCountColumn
Line Input #1, temp
ColumnNames(counter) = temp
counter = counter + 1
Loop

intCountheader = intCountColumn + 6

intCountRows = 0

Do While Not EOF(1) ' Schleife bis Dateiende.
Line Input #1, temp
intCountRows = intCountRows + 1
Loop
intCountRows = intCountRows - 1

MsgBox "Reading: " & intCountColumn & " Columns und " & intCountRows & " Rows ", 48, "Status"

' FInfo = Array(Array(0, 1), Array(25, 1), Array(39, 1))
ReDim FInfo(intCountColumn - 1)
For counter = 0 To intCountColumn - 1
If counter = 0 Then
FInfo(counter) = Array(0, 1)
End If
If counter = 1 Then
FInfo(counter) = Array(25, 1)
End If
If counter > 1 Then
FInfo(counter) = Array(((counter - 1) * 14) + 25, 1)
End If
Next counter



' FInfo = Array(Array(0, 1), Array(25, 1), Array(39, 1))

Debug.Print "Before opening workbook"
Workbooks.OpenText Filename:=datei1, Origin:=xlWindows, _
StartRow:=intCountheader, DataType:=xlFixedWidth, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, Comma:=False, _
Space:=False, Other:=False, FieldInfo:=FInfo()

Debug.Print "After opening workbook"

Set wb = Workbooks(Workbooks.Count)

wb.Activate

wb.Sheets(Sheets.Count).Activate


wb.ActiveSheet.Rows(1).Insert
' wb.ActiveSheet.Rows(1).Insert
wb.ActiveSheet.Range(Cells(1, 1), Cells(1, intCountColumn)) = ColumnNames
wb.ActiveSheet.Range(Cells(1, 1), Cells(1, intCountColumn)).WrapText = True
wb.ActiveSheet.Range(Cells(2, 1), Cells(2, intCountColumn)).Font.Bold = True

' For b = 2 To intCountColumn
' wb.ActiveSheet.Cells(2, b) = Application.WorksheetFunction.Sum(ActiveSheet.Range(Cells(4, b), Cells(intCountRows + 4, b)))
' wb.ActiveSheet.Cells(3, b) = Application.WorksheetFunction.Average(ActiveSheet.Range(Cells(4, b), Cells(intCountRows + 4, b)))
' Next b

' wb.ActiveSheet.Cells(2, 1) = "Col.Sum:"
' wb.ActiveSheet.Cells(3, 1) = "Col.Avg:"
' wb.ActiveSheet.Cells(1, 1).ColumnWidth = 15


Close #1

End Sub


Private Sub Workbook_Open()

End Sub





The changes are on the line "strCountColumn_ = Mid(strCountColumn, 18)" where it was previously 17, causing error. Also at one place "count" was misspelled "coutn" and in another "False" was misspelled "Flase".
Post Reply