[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[TRNSYS-users] calling excel, excel macro



Dear Users,

 

I use excel files in my project as schedule.  So I copy macro ‘TRNSYS’ from example file.

Each of my excel files have about 14 inputs and 14 outputs, so I change  marco ‘TRNSYS’ this way:

 

Sub TRNSYS(Optional Input1 As Variant, _

           Optional Input2 As Variant, _

           Optional Input3 As Variant, _

           Optional Input4 As Variant, _

           Optional Input5 As Variant, _

           Optional Input6 As Variant, _

           Optional Input7 As Variant, _

           Optional Input8 As Variant, _

           Optional Input9 As Variant, _

           Optional Input10 As Variant, _

           Optional Input11 As Variant, _

           Optional Input12 As Variant, _

           Optional Input13 As Variant, _

           Optional Input14 As Variant, _

           Optional Input15 As Variant)

        With Names

            If Not IsMissing(Input1) Then: .Item("Inp1").RefersToRange = Input1: Else: GoTo GoOn

            If Not IsMissing(Input2) Then: .Item("Inp2").RefersToRange = Input2: Else: GoTo GoOn

            If Not IsMissing(Input3) Then: .Item("Inp3").RefersToRange = Input3: Else: GoTo GoOn

            If Not IsMissing(Input4) Then: .Item("Inp4").RefersToRange = Input4: Else: GoTo GoOn

            If Not IsMissing(Input5) Then: .Item("Inp5").RefersToRange = Input5: Else: GoTo GoOn

            If Not IsMissing(Input6) Then: .Item("Inp6").RefersToRange = Input6: Else: GoTo GoOn

            If Not IsMissing(Input7) Then: .Item("Inp7").RefersToRange = Input7: Else: GoTo GoOn

            If Not IsMissing(Input8) Then: .Item("Inp8").RefersToRange = Input8: Else: GoTo GoOn

            If Not IsMissing(Input9) Then: .Item("Inp9").RefersToRange = Input9: Else: GoTo GoOn

            If Not IsMissing(Input10) Then: .Item("Inp10").RefersToRange = Input10: Else: GoTo GoOn

            If Not IsMissing(Input11) Then: .Item("Inp11").RefersToRange = Input11: Else: GoTo GoOn

            If Not IsMissing(Input12) Then: .Item("Inp12").RefersToRange = Input12: Else: GoTo GoOn

            If Not IsMissing(Input13) Then: .Item("Inp13").RefersToRange = Input13: Else: GoTo GoOn

            If Not IsMissing(Input14) Then: .Item("Inp14").RefersToRange = Input14: Else: GoTo GoOn

            If Not IsMissing(Input15) Then: .Item("Inp15").RefersToRange = Input15: Else: GoTo GoOn

        End With

GoOn:

End Sub

 

The problem is that TRNSYS use files if I set 8 or less Inputs (in type 62), otherwise it take only Outputs without substitute Inputs…

 

Dou you have some idea what is the reason?

Maybe I have wrong macro, but I am new in Visual Basic…

 

I enclose pone of my excel files.

------------------------------------------------

Karol Bandurski MSc.

Institute of Environmental Engineering

Poznan University of Technology

www.ee.put.poznan.pl

www.put.poznan.pl

 

Attachment: DANE_GH.xls
Description: MS-Excel spreadsheet