D
Dan Thompson
I am trying to pass a string array as an argument for a function, but I keep
getting this compile error,
Type mismatch: array or user-defined type expected
Here is my code, why won't this work ?
Option Explicit
Option Base 1
Dim Oil(18), Gas(18), HO(18) As String
Sub SetChrtPosAndColor()
GetChartNumsFromTxtFile
WriteChartNums2txtFile Oil
End Sub
Function GetChartNumsFromTxtFile()
Dim X As Integer
Open "C:\ChrtNumLst.txt" For Input As #1
For X = 1 To 54
If X < 19 Then
Line Input #1, Oil(X)
ElseIf X > 18 And X < 37 Then
Line Input #1, Gas(X - 18)
ElseIf X > 36 Then
Line Input #1, HO(X - 36)
End If
Next X
Close #1
End Function
Function WriteChartNums2txtFile(Commodity() As String)
Dim X As Integer
Open "C:\WriteChtNum.txt" For Output As #1
For X = 1 To 18
Print #1, Commodity(X)
Next X
Close #1
End Function
Dan Thompson.
getting this compile error,
Type mismatch: array or user-defined type expected
Here is my code, why won't this work ?
Option Explicit
Option Base 1
Dim Oil(18), Gas(18), HO(18) As String
Sub SetChrtPosAndColor()
GetChartNumsFromTxtFile
WriteChartNums2txtFile Oil
End Sub
Function GetChartNumsFromTxtFile()
Dim X As Integer
Open "C:\ChrtNumLst.txt" For Input As #1
For X = 1 To 54
If X < 19 Then
Line Input #1, Oil(X)
ElseIf X > 18 And X < 37 Then
Line Input #1, Gas(X - 18)
ElseIf X > 36 Then
Line Input #1, HO(X - 36)
End If
Next X
Close #1
End Function
Function WriteChartNums2txtFile(Commodity() As String)
Dim X As Integer
Open "C:\WriteChtNum.txt" For Output As #1
For X = 1 To 18
Print #1, Commodity(X)
Next X
Close #1
End Function
Dan Thompson.