Кажется, этого должно быть очень легко достичь, но в данный момент я борюсь, любая помощь будет принята с благодарностью. информация о дате. Я хочу передать переменную, связанную с этим типом, в функцию, индексируя ее каждый месяц. Ниже указаны тип, подпрограмма и функция.
Я понимаю, что функция не знает типа TestMDate, я пробовал объявить тип внутри функции, но ничего не работает.
заранее большое спасибо
glw
''''''''''''''''''''''''''''''''
'UDT
''''''''''''''''''''''''''''''''
Private Type TestMDate
MonthS As String
MonthD As String
StartD As String
EndD As String
End Type
''''''''''''''''''''''''''''''''
'Sub
''''''''''''''''''''''''''''''''
Sub UpdateChart()
Dim Tstruct(12) As TestMDate
Dim a As Integer, i As Integer
''''''''''''''''''''''''''''''''
'
''''''''''''''''''''''''''''''''
Tstruct(1).MonthS = "Jan"
Tstruct(1).MonthD = "01"
Tstruct(1).StartD = "01"
Tstruct(1).EndD = "31"
Tstruct(2).MonthS = "Feb"
Tstruct(2).MonthD = "02"
Tstruct(2).StartD = "01"
Tstruct(2).EndD = "28"
Tstruct(3).MonthS = "Mar"
Tstruct(3).MonthD = "03"
Tstruct(3).StartD = "01"
Tstruct(3).EndD = "31"
Tstruct(4).MonthS = "Apr"
Tstruct(4).MonthD = "04"
Tstruct(4).StartD = "01"
Tstruct(4).EndD = "30"
Tstruct(5).MonthS = "May"
Tstruct(5).MonthD = "05"
Tstruct(5).StartD = "01"
Tstruct(5).EndD = "31"
Tstruct(6).MonthS = "Jun"
Tstruct(6).MonthD = "06"
Tstruct(6).StartD = "01"
Tstruct(6).EndD = "30"
Tstruct(7).MonthS = "Jul"
Tstruct(7).MonthD = "07"
Tstruct(7).StartD = "01"
Tstruct(7).EndD = "31"
Tstruct(8).MonthS = "Aug"
Tstruct(8).MonthD = "08"
Tstruct(8).StartD = "01"
Tstruct(8).EndD = "31"
Tstruct(9).MonthS = "Sep"
Tstruct(9).MonthD = "09"
Tstruct(9).StartD = "01"
Tstruct(9).EndD = "30"
Tstruct(10).MonthS = "Oct"
Tstruct(10).MonthD = "10"
Tstruct(10).StartD = "01"
Tstruct(10).EndD = "31"
Tstruct(11).MonthS = "Nov"
Tstruct(11).MonthD = "11"
Tstruct(11).StartD = "01"
Tstruct(11).EndD = "30"
Tstruct(12).MonthS = "Dec"
Tstruct(12).MonthD = "12"
Tstruct(12).StartD = "01"
Tstruct(12).EndD = "31"
For i = 1 To 12
a = proc_res_field(Tstruct(i))
Next i
End Sub
''''''''''''''''''''''''''''''''
'Function
''''''''''''''''''''''''''''''''
Function proc_res_field(Tstruct As TestMDate)
Debug.Print Tstruct.MonthS
Debug.Print Tstruct.MonthD
Debug.Print Tstruct.StartD
Debug.Print Tstruct.EndD
a = 1
End Function